[英]Doctrine 2 Gedmo extensions not working with error: “does not exist, or could not be auto-loaded”
We are having issues getting Gedmo plugins to work in our ZF 2 Doctrine 2 installation 我们在让Gedmo插件在ZF 2 Doctrine 2安装中工作时遇到问题
We are getting this error from generate entities: 我们从生成实体中得到了这个错误:
[Semantical Error] The annotation "@Gedmo\Mapping\Annotation\Timestampable" in property Wallet\Entity\Entity::$created does not exist, or could not be auto-loaded.
Our entity looks like this: 我们的实体看起来像这样:
...
use Gedmo\Mapping\Annotation as Gedmo;
...
/**
* @var datetime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
public $created;
...
We have also tried: 我们也尝试过:
/**
* @var datetime $created
*
* @\Gedmo\Mapping\Annotation\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
public $created;
And 和
/**
* @var datetime $created
*
* @Gedmo\Mapping\Annotation\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
public $created;
We have verified that the path is correct and that the php class exists at that path. 我们已经验证了该路径正确,并且该路径中存在php类。
Our module config looks like this: 我们的模块配置如下所示:
'doctrine' => array(
'eventmanager' => array(
'orm_default' => array(
'subscribers' => array(
'Gedmo\Tree\TreeListener',
'Gedmo\Timestampable\TimestampableListener',
'Gedmo\Sluggable\SluggableListener',
'Gedmo\Loggable\LoggableListener',
'Gedmo\Sortable\SortableListener',
),
),
),
Our composer config looks like this: 我们的作曲者配置如下所示:
...
"require": {
...
"gedmo/doctrine-extensions": "2.4.*",
…
We have also tried: 我们也尝试过:
...
"require": {
...
"gedmo/doctrine-extensions": "2.3.*",
…
None of the articles I have found on the issue have helped so far. 到目前为止,我发现的有关该问题的文章均无济于事。
Any suggestions you can offer would be very appreciated. 您可以提供的任何建议将不胜感激。
All the best. 祝一切顺利。
Will 将
Our developer fixed it over the weekend when we realized that we were missing loading in the listeners in the console.php. 当我们意识到在console.php的侦听器中缺少加载时,我们的开发人员在周末对其进行了修复。
He added them like so: $evm = new \\Doctrine\\Common\\EventManager(); 他这样添加它们:$ evm = new \\ Doctrine \\ Common \\ EventManager(); $evm->addEventSubscriber(new \\Gedmo\\Timestampable\\TimestampableListener());
$ evm-> addEventSubscriber(new \\ Gedmo \\ Timestampable \\ TimestampableListener());
He found his sample code here: 他在这里找到了示例代码:
https://gist.github.com/l3pp4rd/964075 https://gist.github.com/l3pp4rd/964075
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.