0

i have a document 'Page' which should have different "elements" of unstructured content on the page.

The mapping of my document is loaded properly (i can create documents) and it looks like that:

<document name="Gondoliere\CoreBundle\Document\Page">

    <nodename name="title" />

    <field name="name" type="string" nullable="true" />

    <parent-document name="parentDocument" />
    <children name="contents" fetch-depth="3" />
</document>

I expect the $home->getContents() to return a collection with my items.

The node:dump --props looks like that:

Home:
- jcr:primaryType = nt:unstructured
- jcr:mixinTypes = Array(    [0] => phpcr:managed)
- phpcr:class = Gondoliere\CoreBundle\Document\Page
- phpcr:classparents = Array()
- name = Startseite
  687509281:
  - jcr:primaryType = nt:unstructured
  - jcr:mixinTypes = Array(    [0] => phpcr:managed)
  - phpcr:class = Gondoliere\CoreBundle\Document\SimpleElement
  - phpcr:classparents = Array()
  - headline = Willkommen
  - body = hier kommt mein Text

Somehow $home->getContents()->count() is always 0. What am I doing wrong. Page::getContents method looks like that:

public function getContents()
{
    return $this->contents;
}
Patrick
  • 1,562
  • 1
  • 16
  • 33
  • In your dump, there are no children under the home page. did you store the other pages as children of that homepage? – dbu Oct 27 '16 at 12:59
  • there is one child, it has a strange name thought ("687509281"). or am i getting the dump wrong? The children are not of type page but of different other types. – Patrick Oct 30 '16 at 20:48
  • ah right, there is the child with the numeric name. that should end up on your Page object in the contents field. – dbu Nov 02 '16 at 14:23
  • Yeah, it should (i think). But $home->getContents()->count() === 0. Always. Do you have any idea? $home is my "/Home" node, i triple-checked that. – Patrick Nov 02 '16 at 16:42

0 Answers0