public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch) { $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\Attribute(); $ak = $mapper->getTargetItemContentObject($targetItem); if (is_object($ak)) { $type = $ak->getAttributeKeyType()->getAttributeTypeHandle(); } else { $collection = $batch->getObjectCollection('attribute_key'); foreach ($collection->getKeys() as $key) { if ($key->getHandle() == $item->getIdentifier()) { $type = $key->getType(); break; } } } if (isset($type)) { $manager = \Core::make('migration/manager/import/attribute/value'); try { $driver = $manager->driver($type); } catch (\Exception $e) { } if (isset($driver)) { $xml = simplexml_load_string($entity->getValue()); $value = $driver->parse($xml); $attribute = $entity->getAttribute(); $attribute->setAttributeValue($value); $manager = \ORM::entityManager('migration_tools'); $manager->persist($attribute); $manager->remove($entity); $manager->flush(); } } }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $user = UserInfo::getByUserName($item->getIdentifier()); if (is_object($user)) { $targetItem = new TargetItem($this); $targetItem->setItemId($user->getUserID()); $targetItem->setItemName($user->getUserDisplayName()); return $targetItem; } }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $list = \Concrete\Core\Area\Area::getHandleList(); if (in_array($item->getIdentifier(), $list)) { $targetItem = new TargetItem($this); $targetItem->setItemId($item->getIdentifier()); $targetItem->setItemName($item->getIdentifier()); return $targetItem; } }
public function getSelectedTargetItem(ItemInterface $item) { $query = $this->entityManager->createQuery("select ti from PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\BatchTargetItem bti\n join PortlandLabs\\Concrete5\\MigrationTool\\Entity\\ContentMapper\\TargetItem ti\n where bti.batch = :batch and bti.target_item = ti and ti.item_type = :type and ti.source_item_identifier = :source_item_identifier"); $query->setParameter('batch', $this->batch); $query->setParameter('source_item_identifier', $item->getIdentifier()); $query->setParameter('type', $this->mapper->getHandle()); $targetItem = $query->getResult(); if (!is_object($targetItem[0])) { return new UnmappedTargetItem($this->mapper); } return $targetItem[0]; }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $type = Type::getByHandle($item->getIdentifier()); if (is_object($type)) { $targetItem = new TargetItem($this); $targetItem->setItemId($type->getPageTypeHandle()); $targetItem->setItemName($type->getPageTypeDisplayName()); return $targetItem; } else { $collection = $batch->getObjectCollection('page_type'); foreach ($collection->getTypes() as $type) { if ($type->getHandle() == $item->getIdentifier()) { $targetItem = new TargetItem($this); $targetItem->setItemId($type->getHandle()); $targetItem->setItemName($type->getHandle()); return $targetItem; } } } }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $template = Template::getByHandle($item->getIdentifier()); if (is_object($template)) { $targetItem = new TargetItem($this); $targetItem->setItemId($template->getPageTemplateHandle()); $targetItem->setItemName($template->getPageTemplateName()); return $targetItem; } else { // we check the current batch. $collection = $batch->getObjectCollection('page_template'); foreach ($collection->getTemplates() as $template) { if ($template->getHandle() == $item->getIdentifier()) { $targetItem = new TargetItem($this); $targetItem->setItemId($template->getHandle()); $targetItem->setItemName($template->getName()); return $targetItem; } } } }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $ak = CollectionKey::getByHandle($item->getIdentifier()); if (is_object($ak)) { $targetItem = new TargetItem($this); $targetItem->setItemId($ak->getAttributeKeyHandle()); $targetItem->setItemName($ak->getAttributeKeyDisplayName()); return $targetItem; } else { // we check the current batch. $collection = $batch->getObjectCollection('attribute_key'); foreach ($collection->getKeys() as $key) { if ($key->getHandle() == $item->getIdentifier()) { $targetItem = new TargetItem($this); $targetItem->setItemId($key->getHandle()); $targetItem->setItemName($key->getHandle()); return $targetItem; } } } }
public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch) { $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\BlockType(); $bt = $mapper->getTargetItemContentObject($targetItem); if (is_object($bt)) { $type = $bt->getBlockTypeHandle(); } else { $collection = $batch->getObjectCollection('block_type'); foreach ($collection->getTypes() as $blockType) { if ($blockType->getHandle() == $item->getIdentifier()) { $type = $blockType->getType(); break; } } } if (isset($type)) { $manager = \Core::make('migration/manager/import/cif_block'); try { $driver = $manager->driver($type); } catch (\Exception $e) { } if (isset($driver)) { $value = null; if ($entity->getValue()) { $xml = simplexml_load_string($entity->getValue()); $value = $driver->parse($xml); } $block = $entity->getBlock(); $block->setBlockValue($value); $manager = \ORM::entityManager('migration_tools'); $manager->persist($block); $manager->remove($entity); $manager->flush(); } } }
public function getMatchedTargetItem(Batch $batch, ItemInterface $item) { $bt = \Concrete\Core\Block\BlockType\BlockType::getByHandle($item->getIdentifier()); if (is_object($bt)) { $targetItem = new TargetItem($this); $targetItem->setItemId($bt->getBlockTypeHandle()); $targetItem->setItemName($bt->getBlockTypeName()); return $targetItem; } else { // we check the current batch. $collection = $batch->getObjectCollection('block_type'); foreach ($collection->getTypes() as $type) { if ($type->getHandle() == $item->getIdentifier()) { $targetItem = new TargetItem($this); $targetItem->setItemId($type->getHandle()); $targetItem->setItemName($type->getHandle()); return $targetItem; } } } }