Skip to content

Commit

Permalink
IBX-7172: loadLocationChildren() not working with multiple objectstat…
Browse files Browse the repository at this point in the history
…e permissions
  • Loading branch information
vidarl committed Jan 9, 2024
1 parent 29489e4 commit 85c58f3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,23 @@ public function buildQueryConstraint(
FilteringQueryBuilder $queryBuilder,
FilteringCriterion $criterion
): ?string {
static $counter = 1;
$tableAlias = 'object_state_link_' . $counter;
++$counter;

/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion\ObjectStateId $criterion */
$queryBuilder
->joinOnce(
'content',
Gateway::OBJECT_STATE_LINK_TABLE,
'object_state_link',
'content.id = object_state_link.contentobject_id',
$tableAlias,
'content.id = ' . $tableAlias . '.contentobject_id',
);

$value = (array)$criterion->value;

return $queryBuilder->expr()->in(
'object_state_link.contentobject_state_id',
$tableAlias . '.contentobject_state_id',
$queryBuilder->createNamedParameter($value, Connection::PARAM_INT_ARRAY)
);
}
Expand Down

0 comments on commit 85c58f3

Please sign in to comment.