12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace WorkflowBundle\EventListener;
- use Doctrine\Common\EventSubscriber;
- use Doctrine\ORM\Event\LifecycleEventArgs;
- use WorkflowBundle\Entity\Action;
- use WorkflowBundle\Utils\DoctrineEvents;
- class ActionEventSubscriber implements EventSubscriber
- {
-
- /**
- * @var array
- */
- protected $twigParams;
-
- public function __construct()
- {
- $this->twigParams = func_get_args();
- }
- /**
- * @return array
- */
- public function getSubscribedEvents()
- {
- return array(
- DoctrineEvents::POST_LOAD,
- );
- }
- /**
- * @param LifecycleEventArgs $args
- */
- public function postLoad(LifecycleEventArgs $args)
- {
- $entity = $args->getEntity();
- if ($entity instanceof Action) {
- $twigParams = $this->twigParams;
- $entity->setTwigParams($twigParams);
- }
- }
- }
|