public function validate($feed) { $messages = new MessageCollection(); $items = $feed->getInspector()->getMatchedItems(); foreach ($items as $item) { $validatorFactory = new Factory($item); $validator = $validatorFactory->getValidator(); if (!$validator->itemExists($item, $this->getBatch())) { $validator->addMissingItemMessage($item, $messages); } } return $messages; }
public function execute(ActionInterface $action) { $blocks = $action->getSubject(); $target = $action->getTarget(); foreach ($blocks as $block) { $value = $block->getBlockValue(); if (is_object($value)) { $inspector = $value->getInspector(); $items = $inspector->getMatchedItems(); foreach ($items as $item) { $validatorFactory = new Factory($item); $validator = $validatorFactory->getValidator(); if (!$validator->itemExists($item, $target->getBatch())) { $validator->addMissingItemMessage($item, $action->getTarget()->getMessages()); } } } } }