FlowQuery Operation Reference

This reference was automatically generated from code on 2024-03-10

add

Adds the given items to the current context. The operation accepts one argument that may be an Array, a FlowQuery or an Object.

Implementation:

Neos\Eel\FlowQuery\Operations\AddOperation

Priority:

1

Final:

No

Returns:

void

backReferenceNodes

“backReferenceNodes” operation working on Nodes

This operation can be used to find the nodes that are referencing a given node:

${q(node).backReferenceNodes().get()}

A referenceName can be specified as argument

${q(node).backReferenceNodes(“someReferenceName”)}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\BackReferenceNodesOperation

Priority:

100

Final:

No

Returns:

void

backReferences

“backReferences” operation working on Nodes

This operation can be used to find incoming references of a given node:

${q(node).backReferences().get()}

The result is an array of {@see Reference} instances.

To render the reference name of the first match:

$q{node).backReferences().get(0).name.value}

The {@see ReferencePropertyOperation} can be used to access any property on the reference relation:

${q(node).backReferences(“someReferenceName”).property(“somePropertyName”)}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\BackReferencesOperation

Priority:

100

Final:

No

Returns:

void

children

“children” operation working on ContentRepository nodes. It iterates over all context elements and returns all child nodes or only those matching the filter expression specified as optional argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ChildrenOperation

Priority:

100

Final:

No

Returns:

void

children

“children” operation working on generic objects. It iterates over all context elements and returns the values of the properties given in the filter expression that has to be specified as argument or in a following filter operation.

Implementation:

Neos\Eel\FlowQuery\Operations\Object\ChildrenOperation

Priority:

1

Final:

No

Returns:

void

closest

“closest” operation working on ContentRepository nodes. For each node in the context, get the first node that matches the selector by testing the node itself and traversing up through its ancestors.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ClosestOperation

Priority:

100

Final:

No

Returns:

void

count

Count the number of elements in the context.

If arguments are given, these are used to filter the elements before counting.

Implementation:

Neos\Eel\FlowQuery\Operations\CountOperation

Priority:

1

Final:

Yes

Returns:

void|integer with the number of elements

filter

Filter operation, limiting the set of objects. The filter expression is expected as string argument and used to reduce the context to matching elements by checking each value against the filter.

A filter expression is written in Fizzle, a grammar inspired by CSS selectors. It has the form “[” [<value>] <operator> <operand> “]” and supports the following operators:

=~

Strict equality of case-insensitive value and operand

=

Strict equality of value and operand

!=~

Strict inequality of case-insensitive value and operand

!=

Strict inequality of value and operand

<

Value is less than operand

<=

Value is less than or equal to operand

>

Value is greater than operand

>=

Value is greater than or equal to operand

$=~

Value ends with operand (string-based) or case-insensitive value’s last element is equal to operand (array-based)

$=

Value ends with operand (string-based) or value’s last element is equal to operand (array-based)

^=~

Value starts with operand (string-based) or case-insensitive value’s first element is equal to operand (array-based)

^=

Value starts with operand (string-based) or value’s first element is equal to operand (array-based)

*=~

Value contains operand (string-based) or case-insensitive value contains an element that is equal to operand (array based)

*=

Value contains operand (string-based) or value contains an element that is equal to operand (array based)

instanceof

Checks if the value is an instance of the operand

!instanceof

Checks if the value is not an instance of the operand

For the latter the behavior is as follows: if the operand is one of the strings object, array, int(eger), float, double, bool(ean) or string the value is checked for being of the specified type. For any other strings the value is used as classname with the PHP instanceof operation to check if the value matches.

Implementation:

Neos\Eel\FlowQuery\Operations\Object\FilterOperation

Priority:

1

Final:

No

Returns:

void

filter

This filter implementation contains specific behavior for use on ContentRepository nodes. It will not evaluate any elements that are not instances of the Node.

The implementation changes the behavior of the instanceof operator to work on node types instead of PHP object types, so that:

[instanceof Neos.NodeTypes:Page]

will in fact use isOfType() on the NodeType of context elements to filter. This filter allow also to filter the current context by a given node. Anything else remains unchanged.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\FilterOperation

Priority:

100

Final:

No

Returns:

void

find

“find” operation working on ContentRepository nodes. This operation allows for retrieval of nodes specified by a path, identifier or node type (recursive).

Example (node name):

q(node).find(‘main’)

Example (relative path):

q(node).find(‘main/text1’)

Example (absolute path):

q(node).find(‘/<Neos.Neos:Sites>/my-site/home’)

Example (identifier):

q(node).find(‘#30e893c1-caef-0ca5-b53d-e5699bb8e506’)

Example (node type):

q(node).find(‘[instanceof Neos.NodeTypes:Text]’)

Example (multiple node types):

q(node).find(‘[instanceof Neos.NodeTypes:Text],[instanceof Neos.NodeTypes:Image]’)

Example (node type with filter):

q(node).find(‘[instanceof Neos.NodeTypes:Text][text*=”Neos”]’)

This operation operates rather on the given Context object than on the given node and thus may work with the legacy node interface until subgraphs are available {@inheritdoc}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\FindOperation

Priority:

100

Final:

No

Returns:

void

first

Get the first element inside the context.

Implementation:

Neos\Eel\FlowQuery\Operations\FirstOperation

Priority:

1

Final:

No

Returns:

void

get

Get a (non-wrapped) element from the context.

If FlowQuery is used, the result is always another FlowQuery. In case you need to pass a FlowQuery result (and lazy evaluation does not work out) you can use get() to unwrap the result from the “FlowQuery envelope”.

If no arguments are given, the full context is returned. Otherwise the value contained in the context at the index given as argument is returned. If no such index exists, NULL is returned.

Implementation:

Neos\Eel\FlowQuery\Operations\GetOperation

Priority:

1

Final:

Yes

Returns:

mixed

has

“has” operation working on Node. Reduce the set of matched elements to those that have a child node that matches the selector or given subject.

Accepts a selector, an array, an object, a traversable object & a FlowQuery object as argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\HasOperation

Priority:

100

Final:

No

Returns:

void

is

Check whether the at least one of the context elements match the given filter.

Without arguments is evaluates to true if the context is not empty. If arguments are given, they are used to filter the context before evaluation.

Implementation:

Neos\Eel\FlowQuery\Operations\IsOperation

Priority:

1

Final:

Yes

Returns:

void|boolean

last

Get the last element inside the context.

Implementation:

Neos\Eel\FlowQuery\Operations\LastOperation

Priority:

1

Final:

No

Returns:

void

neosUiDefaultNodes

Implementation:

Neos\Neos\Ui\FlowQueryOperations\NeosUiDefaultNodesOperation

Priority:

110

Final:

No

Returns:

void

neosUiFilteredChildren

“children” operation working on ContentRepository nodes. It iterates over all context elements and returns all child nodes or only those matching the filter expression specified as optional argument.

Implementation:

Neos\Neos\Ui\FlowQueryOperations\NeosUiFilteredChildrenOperation

Priority:

500

Final:

No

Returns:

void

next

“next” operation working on ContentRepository nodes. It iterates over all context elements and returns the immediately following sibling. If an optional filter expression is provided, it only returns the node if it matches the given expression.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\NextOperation

Priority:

100

Final:

No

Returns:

void

nextAll

“nextAll” operation working on ContentRepository nodes. It iterates over all context elements and returns each following sibling or only those matching the filter expression specified as optional argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\NextAllOperation

Priority:

0

Final:

No

Returns:

void

nextUntil

“nextUntil” operation working on ContentRepository nodes. It iterates over all context elements and returns each following sibling until the matching sibling is found. If an optional filter expression is provided as a second argument, it only returns the nodes matching the given expression.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\NextUntilOperation

Priority:

0

Final:

No

Returns:

void

parent

“parent” operation working on ContentRepository nodes. It iterates over all context elements and returns each direct parent nodes or only those matching the filter expression specified as optional argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ParentOperation

Priority:

100

Final:

No

Returns:

void

parents

“parents” operation working on ContentRepository nodes. It iterates over all context elements and returns the parent nodes or only those matching the filter expression specified as optional argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ParentsOperation

Priority:

0

Final:

No

Returns:

void

parentsUntil

“parentsUntil” operation working on ContentRepository nodes. It iterates over all context elements and returns the parent nodes until the matching parent is found. If an optional filter expression is provided as a second argument, it only returns the nodes matching the given expression.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ParentsUntilOperation

Priority:

0

Final:

No

Returns:

void

prev

“prev” operation working on ContentRepository nodes. It iterates over all context elements and returns the immediately preceding sibling. If an optional filter expression is provided, it only returns the node if it matches the given expression.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\PrevOperation

Priority:

100

Final:

No

Returns:

void

prevAll

“prevAll” operation working on ContentRepository nodes. It iterates over all context elements and returns each preceding sibling or only those matching the filter expression specified as optional argument

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\PrevAllOperation

Priority:

0

Final:

No

Returns:

void

prevUntil

“prevUntil” operation working on ContentRepository nodes. It iterates over all context elements and returns each preceding sibling until the matching sibling is found. If an optional filter expression is provided as a second argument, it only returns the nodes matching the given expression.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\PrevUntilOperation

Priority:

0

Final:

No

Returns:

void

property

Used to access properties of a ContentRepository Node. If the property mame is prefixed with _, internal node properties like start time, end time, hidden are accessed.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\PropertyOperation

Priority:

100

Final:

Yes

Returns:

mixed

property

Access properties of an object using ObjectAccess.

Expects the name of a property as argument. If the context is empty, NULL is returned. Otherwise the value of the property on the first context element is returned.

Implementation:

Neos\Eel\FlowQuery\Operations\Object\PropertyOperation

Priority:

1

Final:

Yes

Returns:

mixed

referenceNodes

“referenceNodes” operation working on Nodes

This operation can be used to find the nodes that are referenced from a given node:

${q(node).referenceNodes().get()}

If a referenceName is given as argument only the references for this name are returned

${q(node).referenceNodes(“someReferenceName”).}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ReferenceNodesOperation

Priority:

100

Final:

No

Returns:

void

referenceProperty

Used to access properties of a ContentRepository Reference

This operation can be used to return the value of a node reference:

${q(node).references(“someReferenceName”).referenceProperty(“somePropertyName”)}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ReferencePropertyOperation

Priority:

100

Final:

Yes

Returns:

mixed

references

“references” operation working on Nodes

This operation can be used to find outgoing references for a given node:

${q(node).references().get()}

The result is an array of {@see Reference} instances.

To render the reference name of the first match:

$q{node).references().get(0).name.value}

The {@see ReferencePropertyOperation} can be used to access any property on the reference relation:

${q(node).references(“someReferenceName”).property(“somePropertyName”)}

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\ReferencesOperation

Priority:

100

Final:

No

Returns:

void

remove

Removes the given Node from the current context.

The operation accepts one argument that may be an Array, a FlowQuery or an Object.

!!! This is a Node specific implementation of the generic remove operation!!!

The result is an array of {@see Node} instances.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\RemoveOperation

Priority:

100

Final:

No

Returns:

void

remove

Removes the given items from the current context. The operation accepts one argument that may be an Array, a FlowQuery or an Object.

Implementation:

Neos\Eel\FlowQuery\Operations\RemoveOperation

Priority:

1

Final:

No

Returns:

void

siblings

“siblings” operation working on ContentRepository nodes. It iterates over all context elements and returns all sibling nodes or only those matching the filter expression specified as optional argument.

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\SiblingsOperation

Priority:

100

Final:

No

Returns:

void

slice

Slice the current context

If no arguments are given, the full context is returned. Otherwise the value contained in the context are sliced with offset and length.

Implementation:

Neos\Eel\FlowQuery\Operations\SliceOperation

Priority:

1

Final:

No

Returns:

void

sort

“sort” operation working on ContentRepository nodes. Sorts nodes by specified node properties.

{@inheritdoc}

First argument is the node property to sort by. Works with internal arguments (_xyz) as well. Second argument is the sort direction (ASC or DESC). Third optional argument are the sort options (see https://www.php.net/manual/en/function.sort):

  • ‘SORT_REGULAR’

  • ‘SORT_NUMERIC’

  • ‘SORT_STRING’

  • ‘SORT_LOCALE_STRING’

  • ‘SORT_NATURAL’

  • ‘SORT_FLAG_CASE’ (use as last option with SORT_STRING, SORT_LOCALE_STRING or SORT_NATURAL)

A single sort option can be supplied as string. Multiple sort options are supplied as array. Other than the above listed sort options throw an error. Omitting the third parameter leaves FlowQuery sort() in SORT_REGULAR sort mode. Example usages:

sort(“title”, “ASC”, [“SORT_NATURAL”, “SORT_FLAG_CASE”]) sort(“risk”, “DESC”, “SORT_NUMERIC”)

Implementation:

Neos\Neos\Eel\FlowQueryOperations\SortOperation

Priority:

1

Final:

No

Returns:

void

unique

“unique” operation working on Nodes

This operation can be used to ensure that nodes are only once in the flow query context

${q(node).backReferences().nodes().unique()get()}

The result is an array of {@see Node} instances.

!!! This is a Node specific implementation of the generic unique operation!!!

Implementation:

Neos\ContentRepository\NodeAccess\FlowQueryOperations\UniqueOperation

Priority:

100

Final:

No

Returns:

void

unique

Removes duplicate items from the current context.

Implementation:

Neos\Eel\FlowQuery\Operations\UniqueOperation

Priority:

1

Final:

No

Returns:

void