1

It's possible to simply filter retrieved Documents by using:

$dm->findBy(array('field' => 'value'))

But I need something a bit more suited to Content Repository specifics. So, is there a way to retrieve Documents (e.g. equivalent to "SELECT ... WHERE ..."), filtered by:

  • an array element (e.g. by first element of a field having multiple values: something like arrayFields[0])
  • path node, e.g. I want to get only children (but not using getChildren() method of a Document) under given path, e.g. /cms/routes/categories - this should return only Documents having '/cms/routes/categories' at the beginning of their path (or Id field)

?

forsberg
  • 1,681
  • 1
  • 21
  • 27

1 Answers1

0

It seems there is (yet?) not available API for the exact solution as mentioned. PHPCR (not ODM) have the features which in a certain way may make these tasks done, though.

The above tasks can be acheived by:

  1. Filtering simply by a multiple-valued field. E.g. if you have "authors" field as an array, the PHPCR seems to correctly sort and filter document by first author available; furtherore in PHPCR (again, not ODM) API there's an equivalent to in_array() PHP function. It's treated as any other (not multivalued) field - http://doctrine-phpcr-odm.readthedocs.org/en/latest/reference/query-builder-reference.html#literal

  2. With filtering by a path, there are three possibilities (the one I mentioned as needed is the third one):

For more, here are docs available: http://doctrine-phpcr-odm.readthedocs.org/en/latest/reference/query-builder.html and http://doctrine-phpcr-odm.readthedocs.org/en/latest/reference/query-builder-reference.html

forsberg
  • 1,681
  • 1
  • 21
  • 27