0
我已经定义在YAML lifecycleCallbacks如下:主义lifecycleCallbacks奇怪的行为
lifecycleCallbacks:
prePersist: [setCreatedAtValue]
preUpdate: [setUpdatedAtValue]
的与各自的功能上面已经生成的实体如下:
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
if($this->created_at == null)
{
$this->created_at = new \DateTime();
}
}
它看起来都很好,对不对?然而,当我尝试打开奏鸣曲管理页面,我得到以下错误
[Semantical Error] The annotation "@ORM\PrePersist" in method AppBundle\Entity\Article::setCreatedAtValue() was never imported. Did you maybe forget to add a "use" statement for this annotation?
我从来没有遇到过这一点,做什么有点混乱。我使用的symfony 2.7.6,学说ORM版本2.5.1,索纳塔管理2.3.7
任何帮助,将不胜感激
由于它的工作,我通常只是靠主义产生的实体和从未有过问题,到现在为止。看起来我需要密切关注更改日志。 –