setParent() public method

Set the parent document for this document.
public setParent ( object $parent )
$parent object
 private function createPage()
 {
     $page = new PageDocument();
     $page->setTitle('Hello');
     $page->setResourceSegment('/hello');
     $page->setParent($this->contentDocument);
     $page->setStructureType('internallinks');
     $page->getStructure()->bind(['title' => 'World', 'internalLinks' => [$this->contentDocument->getUuid()]], true);
     $this->documentManager->persist($page, 'fr');
     $this->documentManager->flush();
     return $page;
 }
Example #2
0
 public function generateDocumentIndex($count, $urlPrefix = '/test-')
 {
     $documents = [];
     for ($i = 1; $i <= $count; ++$i) {
         $pageDocument = new PageDocument();
         $pageDocument->setStructureType('default');
         $pageDocument->setParent($this->homeDocument);
         $pageDocument->setTitle('Document Title ' . $i);
         $pageDocument->setWorkflowStage(WorkflowStage::PUBLISHED);
         $pageDocument->setResourceSegment($urlPrefix . $i);
         $this->documentManager->persist($pageDocument, 'de');
         $documents[] = $pageDocument;
     }
     $this->documentManager->flush();
     return $documents;
 }
Example #3
0
 public function testSaveDocumentWithBlocks()
 {
     $document = new PageDocument();
     $document->setTitle('Places');
     $document->setStructureType('blocks');
     $document->setResourceSegment('/places');
     $document->setWorkflowStage(WorkflowStage::PUBLISHED);
     $document->getStructure()->bind(['block' => [['type' => 'article', 'title' => 'Dornbirn', 'article' => 'Dornbirn Austrua'], ['type' => 'article', 'title' => 'Basel', 'article' => 'Basel Switzerland', 'lines' => ['line1', 'line2']]]], false);
     $document->setParent($this->homeDocument);
     $this->documentManager->persist($document, 'de');
     $this->documentManager->flush();
     $searchManager = $this->getSearchManager();
     $searches = ['Places' => 1, 'Basel' => 1, 'Dornbirn' => 1];
     foreach ($searches as $search => $count) {
         $res = $searchManager->createSearch($search)->locale('de')->index('page')->execute();
         $this->assertCount($count, $res, 'Searching for: ' . $search);
     }
 }
 private function createPage($data)
 {
     $page = new PageDocument();
     $page->setTitle('Hello');
     $page->setParent($this->parent);
     $page->setStructureType('contact');
     $page->setResourceSegment('/foo');
     $page->getStructure()->bind($data, true);
     return $page;
 }