- 我添加了一個新的列在我的數據庫爲我的聯繫方式表稱爲
added_date
- 加入此列到我的聯繫人實體類
$added_date
添加GET-setter方法稱爲
getAddedDate()
和setAddedDate()
Symfony的類中沒有字段或關聯class Contact { private $added_date; public function __construct() { $this->added_date = new \DateTime(); } public function getAddedDate() { return $this->added_date; } public function setAddedDate($added_date) { $this->added_date = $added_date; return $this; } }
侮我有一列接觸類稱爲added_date
,它的類型是DATETIME
當我運行一個DQL查詢是這樣的: SELECT c.added_date FROM Acme\Entity\Contact c WHERE c.id = :id
我得到[Semantical Error] line 0, col 26 near 'added_date FROM': Error: Class Acme\Entity\Contact has no field or association named added_date
如果您嘗試'SELECT c.addedDate ...',該怎麼辦? – D4V1D
你可以發佈實體的ORM定義嗎?陽明海運/註解? – Matteo
@Matteo感謝Matteo提出這個問題,那就是問題 –