2

I have following structure in phpcr

/foo1
/foo1/childcollection1
/foo1/childcollection2
/foo1/childcollection3
/foo2
/foo2/childcollection1
/foo2/childcollcetion2
/foo2/childcollection3
/foo2/childcollection4
/foo3
/foo4
/foo4/childcollection1
/foo4/childcollcetion2
...

I need to fatch only "foo" nodes which have at least one childcollection.

Childcollection is mapped in foo document as /** PHPCRODM\Children(fetchDepth=0) */

I was able to do it by following inner join query in my repository

$query = $this->createQueryBuilder('foo');
        $query->addJoinInner()
            ->right()->document('Path\PathBundle\Document\Childcollection', 'c')->end()
            ->condition()->child('c', 'foo');

As a result I do have foo documents which have at least one childcollection node, but when I add page functionality

$query->setMaxResults($limit);

I don't have a $limit number of documents. Result depends of number of childcollections in foo documents.

Can anybody help me with query to fetch only nodes with at least one childcollection and where I can add page functionality to that query.

Thanks and best regards

kukipei
  • 631
  • 2
  • 8
  • 32
  • this was cross-posted on the mailinglist and will be discussed there: https://groups.google.com/forum/#!topic/phpcr-users/CJQkkhuUvZE – dbu Feb 19 '14 at 08:04

0 Answers0