objectrelationfilter

UNIX name Owner Status
objectrelationfilter Norbert Wagner stable
Version Compatible with
0.1 3.6+, 4.0+
This extended_attribute_filter is very useful for fetching reverse related objects while making use of filtering and sorting options that the fetch(content, reverse_related_objects) function doesn't provide.

It is used in combination with fetch(content, list) or fetch(content, tree). It filters nodes based on their relation with other objects, either by attribute level relation or by object level relation.

As it is a extended_attribute_filter, the syntax follows the general syntax of that filter:

fetch('content',
'list'|'tree',
hash(
'parent_node_id', $id,
'extended_attribute_filter',
hash(
'id', 'ObjectRelationFilter',
'params', $params
),
...
)
}

$params is an array with the parameters for the ObjectRelationFilter:

$params = array(
['or'|'and',]
$attribute_id, $object_id
[, $attribute_id, $object_id]
...
)

The first element is either 'or' or 'and' or it can be omitted. In that case 'and' is assumed.
It serves as the glue logic between the subsequent attribute/object id pairs.
The attribute_id is the numerical attribute id of the object class we want to filter. This attribute has to be of type ezobjectrelation or ezobjectrelationlist.
The object_id can be a integer or an array of integers. In the first case the match is made on the relation with that object, the latter case will match on any object id contained in the array.
Multiple attribute_id/object_id pairs can be specified. They will be combined with AND or OR logic, depending on the first argument.
The fetch is executed as a single SQL query, and therefore very eficient.

Average rating 5.00 by 1 reviewers.