public function getObjectCollection(\SimpleXMLElement $element) { $this->simplexml = $element; $i = 0; $collection = new PageObjectCollection(); if ($this->hasPageNodes()) { foreach ($this->getPageNodes() as $node) { $page = $this->parsePage($node); $page->setPosition($i); ++$i; $collection->getPages()->add($page); $page->setCollection($collection); } } return $collection; }
public function getObjectCollection(\SimpleXMLElement $element, array $namespaces) { $this->simplexml = $element; $this->namespaces = $namespaces; $collection = new PageObjectCollection(); $pages = $this->createParentPages(); foreach ($this->getPageNodes() as $node) { $pages[] = $this->parsePage($node); } // Order pages by its path so parent pages are created first usort($pages, array($this, 'comparePath')); $i = 0; foreach ($pages as $page) { $page->setPosition($i); ++$i; $collection->getPages()->add($page); $page->setCollection($collection); // Do not Normalize path when processing the batch later on $page->setNormalizePath(false); } return $collection; }