/**
  * Create notification action.
  *
  * @param CreateActionEvent $event
  */
 public function createAction(CreateActionEvent $event)
 {
     $config = $event->getConfig();
     if ($config['type'] === 'workflow_notification') {
         $action = new NotificationAction($this->getService('event-dispatcher'), $this->getService('workflow.notification.queue'), $config['notification_id'], $config['notification_language'] ?: null);
         $event->setAction($action);
     }
 }
 /**
  * Load actions for all loaded transitions.
  *
  * @param Workflow $workflow The workflow being build.
  *
  * @throws DefinitionException If action could not be created for the action config.
  *
  * @return void
  */
 private function createActions(Workflow $workflow)
 {
     $collection = $this->findActions();
     if (!$collection) {
         return;
     }
     while ($collection->next()) {
         /** @var ActionModel $model */
         $model = $collection->current();
         $event = new CreateActionEvent($workflow, $this->transitions[$model->pid], $model->row(), Definition::SOURCE_DATABASE);
         if ($model->postAction) {
             $event->setPostAction(true);
         }
         $this->getServiceContainer()->getEventDispatcher()->dispatch($event::NAME, $event);
         if (!$event->getAction()) {
             throw new DefinitionException(sprintf('No action created for action defintion ID "%s"', $model->id));
         } elseif ($event->isPostAction()) {
             $this->transitions[$model->pid]->addPostAction($event->getAction());
         } else {
             $this->transitions[$model->pid]->addAction($event->getAction());
         }
     }
 }