From d394a1686430c1e27b325d3ded957bb04116c51b Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 11 Mar 2024 17:41:24 +0100 Subject: [PATCH] Move IsContainerQueryBuilder from Location to Contnet --- .../IsContainerQueryBuilder.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) rename src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/{Location => Content}/IsContainerQueryBuilder.php (76%) diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/IsContainerQueryBuilder.php similarity index 76% rename from src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php rename to src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/IsContainerQueryBuilder.php index 74dbcc890a..fc4161230f 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/IsContainerQueryBuilder.php @@ -6,37 +6,38 @@ */ declare(strict_types=1); -namespace Ibexa\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location; +namespace Ibexa\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Content; use Doctrine\DBAL\ParameterType; use Ibexa\Contracts\Core\Persistence\Filter\Doctrine\FilteringQueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsContainer; +use Ibexa\Contracts\Core\Repository\Values\Filter\CriterionQueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion; use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway; /** * @internal for internal use by Repository Filtering */ -final class IsContainerQueryBuilder extends BaseLocationCriterionQueryBuilder +final class IsContainerQueryBuilder implements CriterionQueryBuilder { public function accepts(FilteringCriterion $criterion): bool { return $criterion instanceof IsContainer; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsContainer $criterion + */ public function buildQueryConstraint( FilteringQueryBuilder $queryBuilder, FilteringCriterion $criterion ): ?string { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsContainer $criterion */ - parent::buildQueryConstraint($queryBuilder, $criterion); - $queryBuilder ->joinOnce( 'content', Gateway::CONTENT_TYPE_TABLE, - 'contentclass', - 'content.contentclass_id = contentclass.id', + 'content_type', + 'content.contentclass_id = content_type.id', ); /** @var array{bool} $criterionValue */ @@ -44,7 +45,7 @@ public function buildQueryConstraint( $isContainer = reset($criterionValue); return $queryBuilder->expr()->in( - 'contentclass.is_container', + 'content_type.is_container', $queryBuilder->createNamedParameter((int)$isContainer, ParameterType::INTEGER) ); }