webCOMAND

query::in()

Defines the repository hierarchical scope for the query IN clause.

Prototype

in(string $cpath): query

Parameters

  • cpath - a cPath string that resolves to a single Folder or object of a content type that extends Folder.  Optionally, one or more of the following space-separated keywords can be specified after the cPath.
    • RELATED - Match objects in the specified folder or any of its parent folders and their children recursively, up to and including the folder just below the repository root.
    • PARENTS - Match objects in the specified folder or any of its parents, excluding the repository root.
    • CHILDREN - Match objects in the specified folder or any of its children recursively.

Return

The updated query object is returned.  This is handy for chaining additional methods.

Example

// simple IN clause
$query->in('/System/Templates');

// simple IN clause with trailing keyword
$query->in('/System/Templates PARENTS');

$cpath can also be an array that contains multiple cPath strings, optionally followed by one or more trailing keywords (RELATED, PARENTS, CHILDREN).

// simple IN clause
$query->in(['/System/Templates']);

// simple IN clause with trailing keyword
$query->in(['/System/Templates PARENTS', '/Users']);

Finally, $cpath can be an array of arrays that contains a cPath string, optionally followed by one or more trailing keywords (RELATED, PARENTS, CHILDREN).

// simple IN clause
$query->in(['/System/Templates']);

// simple IN clause with trailing keyword
$query->in([['/System/Templates', 'PARENTS'], ['/Users'] ]);