I've been trying to use the gedmo sluggable behavior for Doctrine2 on a ZF2 RC2 application using MongoDB but always end up with an error saying that Doctrine can't find the annotation even though its listener has suscribed to the event manager in the config file.
Here's the exact error message i get :
[Semantical Error] The annotation "@Gedmo\Mapping\Annotation\Slug" in property Application\Document\Place::$login does not exist, or could not be auto-loaded.
My module.doctrine-mongo-odm.local.php
file contains the following regarding this issue :
[...]
'eventmanager' => array(
'odm_default' => array(
'subscribers' => array(
'Gedmo\Sluggable\SluggableListener'
)
)
),
[...]
I know the SluggableListener
is loaded by just putting a pretty die;
in the __construct()
so that means the autoload works.
Now in the Place
document i make use of the slug on the login
property via annotations just like that :
<?php
namespace Application\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM
, Gedmo\Mapping\Annotation as Gedmo;
/** @ODM\Document(collection="places") */
class Place
{
[...]
/**
* @ODM\String
* @Gedmo\Slug(fields={name})
*/
private $login;
/** @ODM\String */
private $name;
[...]
What am i missing there ? Thanks for your help !
You'll need to register any extra annotations, not just add listeners. Use the following key in the Mongo module config:
'configuration' => array(
'odm_default' => array(
'annotations' => array(), // array('Annotation\Namespace\' => '/../annotation/path')
)
),