How to configure doctrine extensions in Zend Framework 2?
doctrine-extensions, doctrine-orm, php, zend-framework2
Solution
The solution was to change my module.config.php to be more like this:
'doctrine' => array(
'driver' => array(
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity'),
),
'orm_default' => array(
'drivers' => array(
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
),
),
),
'eventmanager' => array(
'orm_default' => array(
'subscribers' => array(
'Gedmo\Timestampable\TimestampableListener',
'Gedmo\SoftDeleteable\SoftDeleteableListener',
),
),
),
),
Problem
I have added this line to my composer.json: ``` "gedmo/doctrine-extensions": "dev-master" ``` And this is inside my module's module.config.php: ``` 'doctrine' => array( 'driver' => array( __NAMESPACE__ . '_driver' => array( 'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity'), ), 'orm_default' => array( 'drivers' => array( __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver' ), ), ), ), ``` Then I want to use timestampable annotaion in my entities, for example: ``` /** * @Gedmo\Timestampable(on="create") * @ORM\Column(type="datetime",nullable=true) */ private $created; /** * @Gedmo\Timestampable(on="update") * @ORM\Column(type="datetime",nullable=true) */ private $updated; ``` But that doesn't work. When I persist the entity with above annotations, the created and updated columns are NULL.