diff --git a/eZ/Publish/Core/Limitation/ObjectStateLimitationType.php b/eZ/Publish/Core/Limitation/ObjectStateLimitationType.php index 28aa2fa218..32278ba5ff 100644 --- a/eZ/Publish/Core/Limitation/ObjectStateLimitationType.php +++ b/eZ/Publish/Core/Limitation/ObjectStateLimitationType.php @@ -225,13 +225,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren return new Criterion\ObjectStateId($groupedLimitationValues[0]); } - // limitations from different groups require logical AND between them - $criterions = []; - foreach ($groupedLimitationValues as $limitationGroup) { - $criterions[] = new Criterion\ObjectStateId($limitationGroup); - } - - return new Criterion\LogicalAnd($criterions); + return new Criterion\ObjectStateId($value->limitationValues); } /** diff --git a/eZ/Publish/Core/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/ObjectStateIdQueryBuilder.php b/eZ/Publish/Core/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/ObjectStateIdQueryBuilder.php index a189f42847..fcb0f5821d 100644 --- a/eZ/Publish/Core/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/ObjectStateIdQueryBuilder.php +++ b/eZ/Publish/Core/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/ObjectStateIdQueryBuilder.php @@ -29,21 +29,19 @@ public function buildQueryConstraint( FilteringQueryBuilder $queryBuilder, FilteringCriterion $criterion ): ?string { - $tableAlias = uniqid('osl_'); - /** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion\ObjectStateId $criterion */ $queryBuilder - ->join( + ->joinOnce( 'content', Gateway::OBJECT_STATE_LINK_TABLE, - $tableAlias, - 'content.id = ' . $tableAlias . '.contentobject_id', + 'object_state_link', + 'content.id = object_state_link.contentobject_id', ); $value = (array)$criterion->value; return $queryBuilder->expr()->in( - $tableAlias . '.contentobject_state_id', + 'object_state_link.contentobject_state_id', $queryBuilder->createNamedParameter($value, Connection::PARAM_INT_ARRAY) ); }