I have a doctrine-phpcr-odm document named article,I want to slugify a field before updating each article.
The event fires for doctrine-orm entities but dosn't fire for doctrine-phpcr-odm documents!
class ArticlePreUpdateListener
{
public function preUpdate(LifecycleEventArgs $args)
{
var_dump($args);
}
}
article.pre_update.listener:
class: AppBundle\EventListener\ArticlePreUpdateListener
tags:
- { name: doctrine.event_listener, event: preUpdate}
According to Docs, Doctrine-PHPCR-ODM events works the same way as for Doctrine ORM events. The only differences are:
doctrine_phpcr.event_subscriber
instead of doctrine.event_listener;
Doctrine\Common\Persistence\Event\LifecycleEventArgs
.