src/PN/Bundle/ProductBundle/EventListener/ProductPriceSubscriber.php
// to both the entity object of the event and the entity manager itself
to both the entity object of the event and the entity manager itself
to both the entity object of the event and the entity manager itself
public function preUpdate(PreUpdateEventArgs $args)
    {
        $entity = $args->getObject();
        if (!$entity instanceof ProductPrice) {
            return;
        }
        if ($args->hasChangedField('deleted') and $args->getOldValue('deleted')==null and $args->getNewValue('deleted') instanceof \DateTime) {
            $userName = $this->container->get('user')->getUserName();
            $entity->setDeletedBy($userName);
        }
    }
public function preUpdate ( PreUpdateEventArgs $ args ) { $ entity = $ args -> getObject ( ) ; if ( ! $ entity instanceof ProductPrice ) { return ; } if ( $ args -> hasChangedField ( 'deleted' ) and $ args -> getOldValue ( 'deleted' ) == null and $ args -> getNewValue ( 'deleted' ) instanceof \ DateTime ) { $ userName = $ this -> container -> get ( 'user' ) -> getUserName ( ) ; $ entity -> setDeletedBy ( $ userName ) ; } }
to both the entity object of the event and the entity manager itself
to both the entity object of the event and the entity manager itself