简体   繁体   English

Doctrine 2 Gedmo扩展无法正常工作并出现错误:“不存在,或无法自动加载”

[英]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.

相关问题 Symfony2注释“ @Gedmo \\ Mapping \\ Annotation \\ Timestampable”不存在,或者无法自动加载 - Symfony2 The annotation “@Gedmo\Mapping\Annotation\Timestampable” does not exist, or could not be auto-loaded 注释不存在,或无法自动加载 - The annotation does not exist, or could not be auto-loaded symfony 3 [语义错误]类AppBundle \\ Entity \\ User中的注释@Doctrine \\ ORM \\ Mapping \\ Model不存在,或者无法自动加载 - symfony 3 [Semantical Error] The annotation @Doctrine\ORM\Mapping\Model in class AppBundle\Entity\User does not exist, or could not be auto-loaded Entities \\ USER_User类中的注释“@Doctrine \\ ORM \\ Mapping \\ Entity”不存在,或者无法自动加载 - The annotation “@Doctrine\ORM\Mapping\Entity” in class Entities\USER_User does not exist, or could not be auto-loaded 属性中的注释不存在,或者无法自动加载 - The annotation in property does not exist, or could not be auto-loaded 自定义约束验证器不存在,或无法自动加载 - Custom constraint validator does not exist, or could not be auto-loaded Symfony4 : 注释不存在,或无法自动加载 (Symfony\\Component\\Validator\\Constraints) - Symfony4 : The annotation does not exist, or could not be auto-loaded (Symfony\Component\Validator\Constraints) 方法中的“@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route”……不存在,或无法自动加载” - “@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route” in method … does not exist, or could not be auto-loaded" JMSSerializer独立 - 注释不存在,或者无法自动加载 - JMSSerializer stand alone - Annotation does not exist, or cannot be auto-loaded Symfony 2 - 属性中的注释不存在,或者无法自动加载。 - Symfony 2 - The annotation in property does not exist, or could not be auto-loaded.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM