我有一个文档“页面”,它应该在页面上有不同的非结构化内容“元素”。
我的文档的映射已正确加载(我可以创建文档),它看起来像这样:
<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>
我希望他们$home->getContents()
能用我的物品返回一个集合。
node:dump --props 看起来像这样:
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
$home->getContents()->count()
总是莫名其妙0
。我究竟做错了什么。Page::getContents 方法如下所示:
public function getContents()
{
return $this->contents;
}