Haven't tried it out, but maybe if you put another end() at the end of the 
first $query? 

->condition()->child('c', 'foo')->end();

Because you don't want to append setMaxResults( ) to that last child-node, 
but to the root-node. N.B.: I'm only starting with PHPCR-ODM myself, so I 
might very well be wrong. I'm curious though. 


On Monday, 17 February 2014 12:23:10 UTC+1, Predrag Lazarević wrote:
>
> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to