Hi I'm tring to do a Symfony event listener following this documentation: http://symfony.com/doc/2.8/cookbook/doctrine/event_listeners_subscribers.html
<?php
namespace FMAppBundleEventListener;
use DoctrineORMEventLifecycleEventArgs;
use FMAdminBundleEntityAddressBillingAddress;
class BillingAdressListener
{
/**
* @param LifecycleEventArgs $args
*/
public function listenBillingAdress(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if(!$entity instanceof BillingAddress){
return;
}
$this->postPersist($args);
}
/**
* @param LifecycleEventArgs $args
*/
public function postPersist(LifecycleEventArgs $args)
{
$em = $args->getEntityManager();
$billingAdress = $args->getEntity();
dump($billingAdress); die();
}
}
service.yml
billing_adress.listener:
class: FMAppBundleEventListenerBillingAdressListener
tags:
- { name: doctrine.event_listener, event: listenBillingAdress }
But nothing is happening when I'm submitting a form with the BillingAddress object.
Did I do something wrong?
Aucun commentaire:
Enregistrer un commentaire