hello i hace problem this code :
ListenerCrud.php
<?php
namespace mio\mioBundle;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\EntityManager;
use mio\mioBundle\Entity\Log;
use Symfony\Component\HttpFoundation\Response;
class ListenerCrud{
public function preUpdate(PreUpdateEventArgs $eventArgs){
if ($eventArgs->getEntity() instanceof Usuario){
$entity = $eventArgs->getEntity();
$entityManager = $eventArgs->getEntityManager();
$log = new Log();
$entityManager->persist($log);
$entityManager->flush();
}
}
}
?>
config.yml :
listenercrud:
class: mio\mioBundle\ListenerCrud
tags:
- { name: doctrine.event_listener, event: preUpdate}
but no create log in database. help me please.thanks