Doctrine 2 Gedmo扩展无法处理错误:“不存在,或者无法自动加载”

We are having issues getting Gedmo plugins to work in our ZF 2 Doctrine 2 installation

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.

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.

He added them like so: $evm = new \Doctrine\Common\EventManager(); $evm->addEventSubscriber(new \Gedmo\Timestampable\TimestampableListener());

He found his sample code here:

https://gist.github.com/l3pp4rd/964075