vendor/craue/formflow-bundle/EventListener/FlowExpiredEventListener.php line 19

Open in your IDE?
  1. <?php
  2. namespace Craue\FormFlowBundle\EventListener;
  3. use Craue\FormFlowBundle\Event\FlowExpiredEvent;
  4. use Symfony\Component\Form\FormError;
  5. /**
  6.  * Adds a validation error to the current step's form if an expired flow is detected.
  7.  *
  8.  * @author Tim Behrendsen <tim@siliconengine.com>
  9.  * @copyright 2011-2024 Christian Raue
  10.  * @license http://opensource.org/licenses/mit-license.php MIT License
  11.  */
  12. class FlowExpiredEventListener {
  13.     use EventListenerWithTranslatorTrait;
  14.     public function onFlowExpired(FlowExpiredEvent $event) {
  15.         $event->getCurrentStepForm()->addError($this->getFlowExpiredFormError());
  16.     }
  17.     /**
  18.      * @return FormError
  19.      */
  20.     protected function getFlowExpiredFormError() {
  21.         $messageId 'craueFormFlow.flowExpired';
  22.         $messageParameters = [];
  23.         return new FormError($this->translator->trans($messageId$messageParameters'validators'), $messageId$messageParameters);
  24.     }
  25. }