123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?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) {
- $entity->setTwigParams($this->twigParams);
- }
- }
- }
|