【发布时间】:2018-12-06 17:51:07
【问题描述】:
在我的pages 实体中,我通过“ManyToOne”添加了图标:
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Icons", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
*/
private $icon;
public function getIcon(): ?Icons
{
return $this->icon;
}
public function setIcon(?Icons $icon): self
{
$this->icon = $icon;
return $this;
}
但是我有这个问题,我收到一条错误消息:
执行 'SELECT t0.id AS id_1, 时发生异常, t0.unique_id AS unique_id_2, t0.name AS name_3, t0.template AS template_4, t0.slug AS slug_5, t0.icon_id AS icon_id_6 FROM pages t0 在哪里 t0.slug = ? LIMIT 1' with params ["pages"]:
SQLSTATE[42S22]:未找到列:1054 中的未知列 't0.icon_id' '字段列表'
【问题讨论】:
-
向实体添加新列后是否更新了数据库架构?
标签: symfony doctrine entity many-to-one