ezsystems/ezpublish-kernel — pull request #547 by taenadil (2013-10-07 16:19:34+00:00)
Title: Implemented EZP-21640: Implement RelationList search criterion

https://jira.ez.no/browse/EZP-21640

Currently, it is not possible to search for Content related (through RelationList) to a specific Content.
In Legacy, this criterion would basically add an additional join to table ezcontentobject_link.

$query = new Query();
$query->criterion = new Criterion\RelationList(
// Field name
"relation_field",
// Operator
Operator::EQ,
// Content ID
42
);
$result = $this->getRepository()->getSearchService()->findContent( $query );

Or:

$query = new Query();
$query->criterion = new Criterion\RelationList(
// Field name
"relation_field",
// Operator
Operator::IN,
// Content ID
array( 42, 43, 44 )
);
$result = $this->getRepository()->getSearchService()->findContent( $query );