EventSubscriber.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace WorkflowBundle\Event;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\Workflow\Event\Event;
  5. use Symfony\Component\Workflow\Event\GuardEvent;
  6. use Symfony\Component\DependencyInjection\ContainerInterface;
  7. # Ayuda:
  8. # http://blog.eleven-labs.com/en/symfony-workflow-component/
  9. # https://github.com/lexik/LexikWorkflowBundle
  10. # https://github.com/fduch/workflow-bundle
  11. class EventSubscriber implements EventSubscriberInterface
  12. {
  13. private $container;
  14. /**
  15. * @param ContainerInterface $container
  16. */
  17. public function __construct(ContainerInterface $container)
  18. {
  19. $this->container = $container;
  20. }
  21. public static function getSubscribedEvents()
  22. {
  23. return array(
  24. 'workflow.transition' => array('transition'),
  25. 'workflow.enter' => array('enter'),
  26. 'workflow.leave' => array('leave'),
  27. 'workflow.guard' => array('guard')
  28. );
  29. }
  30. public function transition(Event $event)
  31. {
  32. }
  33. public function leave(Event $event)
  34. {
  35. }
  36. public function enter(Event $event)
  37. {
  38. }
  39. public function guard(GuardEvent $event)
  40. {
  41. //$event->setBlocked(true);
  42. }
  43. }