public function validate($entity)
 {
     $messages = new MessageCollection();
     if (!$this->userExists($entity->getUserName(), $this->getBatch())) {
         $messages->add(new Message(t('User %s does not exist in the site or in the current content batch', $entity->getUserName())));
     }
     return $messages;
 }
 /**
  * @param $key TopicsAttributeKey
  *
  * @return MessageCollection
  */
 public function validate($key)
 {
     $messages = new MessageCollection();
     if (!$this->topicTreeExists($key->getTreeName(), $this->getBatch())) {
         $messages->add(new Message(t('Topic tree %s does not exist in the site or in the current content batch', $key->getTreeName())));
     }
     return $messages;
 }
 public function validate($key)
 {
     $messages = new MessageCollection();
     // Validate the category
     if (!$this->categoryExists($key->getCategory(), $this->getBatch())) {
         $messages->add(new Message(t('Permission category %s does not exist in the site or in the current content batch', $key->getCategory())));
     }
     foreach ($key->getAccessEntities() as $entity) {
         $validator = $entity->getRecordValidator($this->getBatch());
         $entityMessages = $validator->validate($entity);
         if (is_object($entityMessages) && count($entityMessages)) {
             foreach ($entityMessages as $message) {
                 $messages->add($message);
             }
         }
     }
     return $messages;
 }
 public function validate($control)
 {
     $messages = new MessageCollection();
     $attributeMapper = new BlockType();
     $targetItemList = new TargetItemList($this->getBatch(), $attributeMapper);
     $item = new Item($control->getItemIdentifier());
     $targetItem = $targetItemList->getSelectedTargetItem($item);
     if ($targetItem instanceof UnmappedTargetItem) {
         $messages->add(new Message(t('Block type <strong>%s</strong> does not exist in the current batch or in the site.', $item->getIdentifier())));
     }
     return $messages;
 }
 public function validate($stack)
 {
     $r = new MessageCollection();
     $blocks = $stack->getBlocks();
     $validator = \Core::make('migration/batch/block/validator', array($this->getBatch()));
     $messages = $validator->validate($blocks);
     if ($messages && count($messages)) {
         foreach ($messages as $message) {
             $r->add($message);
         }
     }
     return $r;
 }
 /**
  * @param $key AttributeKey
  *
  * @return MessageCollection
  */
 public function validate($key)
 {
     $messages = new MessageCollection();
     if ($key instanceof UnknownAttributeKey) {
         $messages->add(new Message(t('Attribute key is of an unknown type. It may not be imported properly.')));
     }
     $validator = $key->getRecordValidator($this->getBatch());
     if (is_object($validator)) {
         $r = $validator->validate($key);
         $messages->addMessages($r);
     }
     return $messages;
 }
 public function validate($set)
 {
     $messages = new MessageCollection();
     $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\BlockType();
     $targetItemList = new TargetItemList($this->getBatch(), $mapper);
     foreach ($set->getTypes() as $type) {
         $item = new Item($type);
         $targetItem = $targetItemList->getSelectedTargetItem($item);
         if ($targetItem instanceof UnmappedTargetItem) {
             $messages->add(new Message(t('Block type <strong>%s</strong> does not exist.', $item->getIdentifier()), Message::E_WARNING));
         }
     }
     return $messages;
 }
 public function validate($set)
 {
     $messages = new MessageCollection();
     $mapper = new Attribute();
     $targetItemList = new TargetItemList($this->getBatch(), $mapper);
     foreach ($set->getAttributes() as $attribute) {
         $item = new Item($attribute);
         $targetItem = $targetItemList->getSelectedTargetItem($item);
         if ($targetItem instanceof UnmappedTargetItem) {
             $messages->add(new Message(t('Attribute <strong>%s</strong> does not exist.', $item->getIdentifier()), Message::E_WARNING));
         }
     }
     return $messages;
 }
 public function addMissingItemMessage(ItemInterface $item, MessageCollection $messages)
 {
     $messages->add(new \PortlandLabs\Concrete5\MigrationTool\Batch\Validator\Message(t('Referenced page type %s cannot be found in the site or in the current content batch.', $item->getReference())));
 }
 public function addMissingItemMessage(ItemInterface $item, MessageCollection $messages)
 {
     $messages->add(new Message(t('Referenced page at path %s cannot be found in the site or in the current content batch.', $item->getReference()), Message::E_WARNING));
 }
 public function addMissingItemMessage(ItemInterface $item, MessageCollection $messages)
 {
     $messages->add(new Message(t('%s content item %s cannot be found', $item->getDisplayName(), $item->getReference()), Message::E_WARNING));
 }