public function findFromCollection(ObjectCollection $collection) { $query = $this->getEntityManager()->createQuery('select b from \\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Export\\Batch b inner join PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Export\\ObjectCollection o where o.id = :id'); $query->setParameter('id', $collection->getID()); // I don't know why this is returning multiple results. Something off about the join. $r = $query->getResult(); return $r[0]; }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('pages'); foreach ($collection->getItems() as $page) { $c = \Page::getByID($page->getItemIdentifier()); if (is_object($c) && !$c->isError()) { $c->export($node); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('pagetypecomposercontroltypes'); foreach ($collection->getItems() as $type) { $t = Type::getByID($type->getItemIdentifier()); if (is_object($t)) { $t->export($node); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('attributekeys'); foreach ($collection->getItems() as $key) { $ak = Key::getInstanceByID($key->getItemIdentifier()); if (is_object($ak)) { $ak->export($node); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('themes'); foreach ($collection->getItems() as $theme) { $t = \Concrete\Core\Page\Theme\Theme::getByID($theme->getItemIdentifier()); if (is_object($t)) { $t->export($node); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('conversationeditors'); foreach ($collection->getItems() as $type) { $t = Editor::getByID($type->getItemIdentifier()); if (is_object($t)) { $t->export($node); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('jobs'); foreach ($collection->getItems() as $type) { $j = \Concrete\Core\Job\Job::getByID($type->getItemIdentifier()); if (is_object($j)) { $nodeType = $node->addChild('job'); $nodeType->addAttribute('handle', $j->getJobHandle()); $nodeType->addAttribute('package', $j->getPackageHandle()); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('blocktypes'); foreach ($collection->getItems() as $type) { $bt = \Concrete\Core\Block\BlockType\BlockType::getByID($type->getItemIdentifier()); if (is_object($bt)) { $nodeType = $node->addChild('blocktype'); $nodeType->addAttribute('handle', $bt->getBlockTypeHandle()); $nodeType->addAttribute('package', $bt->getPackageHandle()); } } }
public function exportCollection(ObjectCollection $collection, \SimpleXMLElement $element) { $node = $element->addChild('attributecategories'); foreach ($collection->getItems() as $category) { $category = Category::getByID($category->getItemIdentifier()); if (is_object($category)) { $cat = $node->addChild('category'); $cat->addAttribute('handle', $category->getAttributeKeyCategoryHandle()); $cat->addAttribute('allow-sets', $category->allowAttributeSets()); $cat->addAttribute('package', $category->getPackageHandle()); } } }
public function add_items_to_batch() { if (!$this->token->validate('add_items_to_batch')) { $this->error->add($this->token->getErrorMessage()); } $exporters = \Core::make('migration/manager/exporters'); $r = $this->entityManager->getRepository('\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Export\\Batch'); $batch = $r->findOneById($this->request->request->get('batch_id')); if (!is_object($batch)) { $this->error->add(t('Invalid batch.')); } $selectedItemType = false; if ($this->request->request->has('item_type') && $this->request->request->get('item_type')) { $selectedItemType = $exporters->driver($this->request->request->get('item_type')); } if (!is_object($selectedItemType)) { $this->error->add(t('Invalid item type.')); } if (!$this->error->has()) { $values = $this->request->request->get('id'); $exportItems = $selectedItemType->getItemsFromRequest($values[$selectedItemType->getHandle()]); $collection = $batch->getObjectCollection($selectedItemType->getHandle()); if (!is_object($collection)) { $collection = new ObjectCollection(); $collection->setType($selectedItemType->getHandle()); $batch->getObjectCollections()->add($collection); } foreach ($exportItems as $item) { if (!$collection->contains($item)) { $item->setCollection($collection); $collection->getItems()->add($item); } } $this->entityManager->persist($batch); $this->entityManager->flush(); $response = new JsonResponse($exportItems); return $response; } $r = new EditResponse(); $r->setError($this->error); $r->outputJSON(); }