/** * @param Action $action * @return bool */ public function matches($action) { // validates on action name foreach ($this->matchersOnActionName as $matcher) { if (!$matcher->matches($action->getName())) { return false; } } // validates on properties foreach ($this->matchersOnPropertyName as $propertyName => $matcher) { if (!$matcher->matches($action->getProperty($propertyName))) { return false; } } return true; }
/** * @param Action $action * @return bool */ public function dispatch($action) { $this->logger->debug("[ActionDispatcher] Going to dispatch action " . $action->getName() . " whose content is : " . json_encode($action->getProperties())); $success = true; foreach ($this->pipelineProvider->getCurrentPipeline()->getStores() as $store) { if ($store->isTriggeredByAction($action)) { $this->logger->debug(" -> store " . $store->getName() . " is triggered by action " . $action->getName()); try { $this->runStore($store, $action); } catch (StoreNotRunnableException $e) { $this->logger->error("Can't dispatch action '" . $action->getName() . "'. Message was : " . $e->getMessage()); $success = false; } } } return $success; }