3

I have relationships linking a node to a child paragraph, with a grandchild paragraph:

Node
 |_ paragraph child
        |_ paragraph grandchild

Using an entityQuery, I can get child items using parent_id as the field/property:

return  $this->paragraphStorage->getQuery()
  ->condition('status', 1)
  ->condition('type', 'paragraph_grandchild')
  ->condition('parent_id', $paragraph_child_ids, 'IN') 
  ->execute();

My problem is that I want to get all grandchildren, but don't want to run 2 queries, and I can't see how to get use the node ID as a condition like I do with parent_id.

For example (this doesn't work):

return  $this->paragraphStorage->getQuery()
  ->condition('status', 1)
  ->condition('type', 'paragraph_grandchild')
  ->condition('parent_id.entity.parent_id', $node_ids, 'IN') 
  ->execute();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.