Erstellt die Abfrage für das Einfügen des Startdatums in die Queue-Tabelle.
@param QueueSetStartTimeEvent   $event
@param                          $eventName
@param EventDispatcherInterface $dispatcher
972466
public function onSetStartTimeListenerQuery(
        QueueSetStartTimeEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $table          = $event->getQueueTable();
        $field          = $event->getField();
        $id             = $event->getId();
        $query          = "UPDATE $table SET $field = " . time() . " WHERE id = $id";
        $event->setQuery($query);
    }
667012
public function onPrepareWorkspaceUploadMaintenancePage(WorkspaceEvent $event, $eventName, EventDispatcherInterface $eventDispatcher)
    {
        $host = $event->getWorkspace()->getHost();
        $connection = $this->ensureConnection($host);

        $directory = sprintf('%s/maintenance/%s', $host->getPath(), $this->documentRoot);
        $context = array('directory' => $directory, 'event.task.action' => TaskInterface::ACTION_IN_PROGRESS);

        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Creating directory "{directory}".', $eventName, $this, $context));
        if ($connection->isDirectory($directory) === false) {
            if ($connection->createDirectory($directory, 0770, true)) {
                $context['event.task.action'] = TaskInterface::ACTION_COMPLETED;
                $context['output.resetLine'] = true;

                $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Created directory "{directory}".', $eventName, $this, $context));
            } else {
                $context['event.task.action'] = TaskInterface::ACTION_FAILED;
                $context['output.resetLine'] = true;

                $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::WARNING, 'Failed creating directory "{directory}".', $eventName, $this, $context));
            }
        } else {
            $context['event.task.action'] = TaskInterface::ACTION_COMPLETED;
            $context['output.resetLine'] = true;

            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Directory "{directory}" exists.', $eventName, $this, $context));
        }

        if ($connection->isDirectory($directory)) {
            $files = array_diff(scandir($this->localMaintenanceDirectory), array('.', '..'));
            foreach ($files as $file) {
                $localFile = $this->localMaintenanceDirectory.'/'.$file;
                if (is_file($localFile)) {
                    $context = array('file' => $localFile, 'event.task.action' => TaskInterface::ACTION_COMPLETED);

                    $uploaded = $connection->putFile($localFile, $directory.'/'.$file);
                    if ($uploaded === true) {
                        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::INFO, 'Uploaded file "{file}".', $eventName, $this, $context));
                    }
                }
            }
        }
    }
1105620
private function dispatchEvent($eventName, MessageEvent $event)
    {
        if ($this->eventDispatcher) {
            return $this->eventDispatcher->dispatch($eventName, $event);
        }

        return $event;
    }
1182171
public function updateAttributePosition(UpdatePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $this->genericUpdatePosition(AttributeTemplateQuery::create(), $event, $dispatcher);
    }
1310663
public function dispatch($eventName, Event $event = null)
    {
        if (null === $event) {
            $event = new Event();
        }

        $event->setDispatcher($this);
        $event->setName($eventName);

        if (!isset($this->listeners[$eventName])) {
            return $event;
        }

        $this->doDispatch($this->getListeners($eventName), $eventName, $event);

        return $event;
    }
1031071
public function onSetErrorListenerQuery(
        QueueSetErrorEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $table          = $event->getQueueTable();
        $field          = $event->getField();
        $id             = $event->getId();
        $query          = "UPDATE $table SET $field = 1 WHERE id = $id";
        $event->setQuery($query);
    }
826453
public function delete(MessageDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== ($message = MessageQuery::create()->findPk($event->getMessageId()))) {
            $message
                ->setDispatcher($dispatcher)
                ->delete()
            ;

            $event->setMessage($message);
        }
    }
898651
public function dispatch(WorkflowDispatchEventInterface $event)
    {
        $event->getMvcEvent()->setParam(static::WORKFLOW_DISPATCH_EVENT, $event);
        $event->setTarget($this);


        $this->getLog()->debug(
            sprintf(
                'Event: %s. Getting metadata to start scheduling cycle workflow',
                WorkflowDispatchEventInterface::LOAD_METADATA_EVENT
            )
        );
        $metadataResult = $this->getEventManager()->trigger(WorkflowDispatchEventInterface::LOAD_METADATA_EVENT, $event, function ($test) {
            return ($test instanceof MetadataInterface);
        });
        $metadata = $metadataResult->last();

        if (!$metadata instanceof MetadataInterface) {
            $this->getLog()->info('No metadata to start scheduling workflow.');
            return;
        }

        $event->setMetadata($metadata);

        $prepareData = [];
        if ($metadata->isFlagRunPrepareData()) {
            $this->getLog()->info(
                sprintf(
                    'Event: %s. Preparing data to run Workflow',
                    WorkflowDispatchEventInterface::PREPARE_DATA_EVENT
                )
            );
            $prepareDataResults = $this->getEventManager()->trigger(WorkflowDispatchEventInterface::PREPARE_DATA_EVENT, $event);
            foreach ($prepareDataResults as $prepareDataResult) {
                if (is_array($prepareDataResult) || $prepareDataResult instanceof Traversable) {
                    $prepareData = ArrayUtils::merge($prepareData, $prepareDataResult);
                }
            }
        }
        $event->setPrepareData($prepareData);


        $flagRunWorkflow = $metadata->isWorkflowDispatch();
        if (true === $flagRunWorkflow) {
            $this->getLog()->info(
                sprintf(
                    'Event: %s. Checking the workflow start conditions',
                    WorkflowDispatchEventInterface::CHECK_RUN_WORKFLOW_EVENT
                )
            );
            $dispatchConditionsResults = $this->getEventManager()->trigger(WorkflowDispatchEventInterface::CHECK_RUN_WORKFLOW_EVENT, $event);
            foreach ($dispatchConditionsResults as $dispatchConditionsResult) {
                if (false === $dispatchConditionsResult) {
                    $this->getLog()->info('Launch Workflow canceled.');
                    $flagRunWorkflow = false;
                    break;
                }
            }
        }

        if (true === $flagRunWorkflow) {
            $this->getLog()->info(
                sprintf(
                    'Event: %s. Getting metadata workflow to run',
                    WorkflowDispatchEventInterface::METADATA_WORKFLOW_TO_RUN_EVENT
                )
            );
            $runWorkflowParamResults = $this->getEventManager()->trigger(WorkflowDispatchEventInterface::METADATA_WORKFLOW_TO_RUN_EVENT, $event, function ($result) {
                return ($result instanceof RunWorkflowParamInterface);
            });
            $runWorkflowParamResult = $runWorkflowParamResults->last();

            if (!$runWorkflowParamResult instanceof RunWorkflowParamInterface) {
                $errMsg = 'There is no evidence to launch workflow';
                throw new Exception\RunWorkflowParamException($errMsg);
            }
            $event->setRunWorkflowParam($runWorkflowParamResult);

            $this->getLog()->info(
                sprintf(
                    'Event: %s. Starting the workflow',
                    WorkflowDispatchEventInterface::RUN_WORKFLOW_EVENT
                )
            );
            $runWorkflowResults = $this->getEventManager()->trigger(WorkflowDispatchEventInterface::RUN_WORKFLOW_EVENT, $event, function ($result) {
                return ($result instanceof TransitionResultInterface);
            });

            $workflowResult = $runWorkflowResults->last();
            if ($workflowResult instanceof TransitionResultInterface) {
                $event->setWorkflowResult($workflowResult);
            }
        }
    }
781121
public function create(AttributeCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $attribute = new AttributeModel();

        $attribute
            ->setDispatcher($dispatcher)
            ->setLocale($event->getLocale())
            ->setTitle($event->getTitle())
            ->save()
        ;

        $event->setAttribute($attribute);

        // Add atribute to all product templates if required
        if ($event->getAddToAllTemplates() != 0) {
            $this->doAddToAllTemplates($attribute);
        }
    }
1315792
public function bind(EventDispatcherInterface $dispatcher, $eventName)
    {
        if (isset($this->events[$eventName])) {
            return;
        }

        $dispatcher->addListener($eventName, $this->getListener(), $this->priority);
        $this->events[$eventName] = true;
    }
402630
public function onLoadQueueListenerRun(LoadQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query  = $event->getQuery();
        $result = $this->database->execute($query);
        $event->setEvents($result);
    }
1184499
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
    {
        if ($this->handler) {
            throw new AlreadyBuildedException('The handler already builded.');
        }

        $this->eventDispatcher = $eventDispatcher;

        return $this;
    }
656311
public function modify(ConfigUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== $config = ConfigQuery::create()->findPk($event->getConfigId())) {
            $config->setDispatcher($dispatcher)
                ->setName($event->getEventName())
                ->setValue($event->getValue())
                ->setHidden($event->getHidden())
                ->setSecured($event->getSecured())
                ->setLocale($event->getLocale())
                ->setTitle($event->getTitle())
                ->setDescription($event->getDescription())
                ->setChapo($event->getChapo())
                ->setPostscriptum($event->getPostscriptum())
            ->save();

            $event->setConfig($config);
        }
    }
621441
public function update(ContentUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== $content = ContentQuery::create()->findPk($event->getContentId())) {
            $con = Propel::getWriteConnection(ContentTableMap::DATABASE_NAME);
            $con->beginTransaction();

            $content->setDispatcher($dispatcher);
            try {
                $content
                    ->setVisible($event->getVisible())
                    ->setLocale($event->getLocale())
                    ->setTitle($event->getTitle())
                    ->setDescription($event->getDescription())
                    ->setChapo($event->getChapo())
                    ->setPostscriptum($event->getPostscriptum())
                    ->save($con)
                ;

                $content->setDefaultFolder($event->getDefaultFolder());

                $event->setContent($content);
                $con->commit();
            } catch (PropelException $e) {
                $con->rollBack();
                throw $e;
            }
        }
    }
1362205
protected function dispatch($eventName, ActionEvent $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }
1242073
public function updateSeo(UpdateSeoEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        return $this->genericUpdateSeo(ContentQuery::create(), $event, $dispatcher);
    }
140690
public function unbind(EventDispatcherInterface $dispatcher)
    {
        foreach ($this->events as $eventName => $_) {
            $dispatcher->removeListener($eventName, $this->getListener());
        }

        $this->events = array();
    }