From 69ff8cd45aeff04023141999b6b7cbf5e5dc5da1 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 12 Feb 2024 08:12:02 +0100 Subject: [PATCH 01/15] IBX-7653: IsContainer criterion added --- .../Content/Query/Criterion/IsContainer.php | 32 ++++++++++++ .../Location/IsContainerQueryBuilder.php | 50 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php create mode 100644 src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php b/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php new file mode 100644 index 0000000000..50011b3dd8 --- /dev/null +++ b/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php @@ -0,0 +1,32 @@ +joinOnce( + 'content', + Gateway::CONTENT_TYPE_TABLE, + 'contentclass', + 'content.contentclass_id = contentclass.id', + ); + + $value = $criterion->value ? 1 : 0; + + return $queryBuilder->expr()->in( + 'contentclass.is_container', + $queryBuilder->createNamedParameter($value, ParameterType::INTEGER) + ); + } +} From 3da12c07d251b49c9387f047a78eca63efc81158 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 19 Feb 2024 13:01:34 +0100 Subject: [PATCH 02/15] IsContainer Query Criterion --- .../Location/IsContainerQueryBuilder.php | 1 - .../legacy/criterion_handlers_common.yml | 7 +++ .../Gateway/CriterionHandler/IsContainer.php | 56 +++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php index 0630937c96..076f48c698 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php @@ -8,7 +8,6 @@ namespace Ibexa\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Location; -use Doctrine\DBAL\Connection; use Doctrine\DBAL\ParameterType; use Ibexa\Contracts\Core\Persistence\Filter\Doctrine\FilteringQueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsContainer; diff --git a/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml b/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml index e62b350481..e4f87f22cf 100644 --- a/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml +++ b/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml @@ -144,6 +144,13 @@ services: - {name: ibexa.search.legacy.gateway.criterion_handler.content} - {name: ibexa.search.legacy.gateway.criterion_handler.location} + Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\IsContainer: + parent: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler + class: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\IsContainer + tags: + - {name: ibexa.search.legacy.gateway.criterion_handler.content} + - {name: ibexa.search.legacy.gateway.criterion_handler.location} + Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\LanguageCode: class: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\LanguageCode parent: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php new file mode 100644 index 0000000000..76be3f91e5 --- /dev/null +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -0,0 +1,56 @@ +connection->createQueryBuilder(); + $subSelect + ->select( + 'id' + )->from( + 'ezcontentclass' + )->where( + $queryBuilder->expr()->eq( + 'is_container', + $queryBuilder->createNamedParameter((int)reset($criterion->value), ParameterType::INTEGER) + ) + ); + + return $queryBuilder->expr()->in( + 'c.contentclass_id', + $subSelect->getSQL() + ); + } +} From 9bd85991df7590eed1d0b40f9dca509b289d31c9 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 21 Feb 2024 17:27:25 +0100 Subject: [PATCH 03/15] IsContainer criterion test added to SearchServiceTest --- .../Core/Repository/SearchServiceTest.php | 8 +++ .../_fixtures/Legacy/IsContainerFalse.php | 59 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php diff --git a/tests/integration/Core/Repository/SearchServiceTest.php b/tests/integration/Core/Repository/SearchServiceTest.php index a2175606e2..6196735afe 100644 --- a/tests/integration/Core/Repository/SearchServiceTest.php +++ b/tests/integration/Core/Repository/SearchServiceTest.php @@ -682,6 +682,14 @@ public function getContentQuerySearches() ], $fixtureDir . 'Visibility.php', ], + [ + [ + 'query' => new Criterion\IsContainer(false), + 'sortClauses' => [new SortClause\ContentId()], + 'limit' => 5, + ], + $fixtureDir . 'IsContainerFalse.php', + ], [ [ 'query' => new Criterion\IsUserEnabled(true), diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php new file mode 100644 index 0000000000..7443ebe674 --- /dev/null +++ b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php @@ -0,0 +1,59 @@ + [], + 'searchHits' => [ + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 10, + 'title' => 'Anonymous User', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 14, + 'title' => 'Administrator User', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 52, + 'title' => 'Common INI settings', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 54, + 'title' => 'Ibexa Demo Design (without demo content)', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + ], + 'spellSuggestion' => null, + 'time' => 1, + 'timedOut' => null, + 'maxScore' => null, + 'totalCount' => 4, +]); From d511a6c2f45c6fa757caede810cf84b497179e54 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 22 Feb 2024 10:21:38 +0100 Subject: [PATCH 04/15] phpstan fix --- .../Content/Common/Gateway/CriterionHandler/IsContainer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php index 76be3f91e5..a56482e609 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -35,6 +35,9 @@ public function handle( Criterion $criterion, array $languageSettings ) { + /** @var bool $isContainer */ + $isContainer = reset($criterion->value); + $subSelect = $this->connection->createQueryBuilder(); $subSelect ->select( @@ -44,7 +47,7 @@ public function handle( )->where( $queryBuilder->expr()->eq( 'is_container', - $queryBuilder->createNamedParameter((int)reset($criterion->value), ParameterType::INTEGER) + $queryBuilder->createNamedParameter((int)$isContainer, ParameterType::INTEGER) ) ); From 0f6749edaae550d1f99216e1c906ea0dd135edf5 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 22 Feb 2024 11:31:06 +0100 Subject: [PATCH 05/15] Additional test --- .../Core/Repository/SearchServiceTest.php | 8 +++ .../_fixtures/Legacy/IsContainerTrue.php | 69 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php diff --git a/tests/integration/Core/Repository/SearchServiceTest.php b/tests/integration/Core/Repository/SearchServiceTest.php index 6196735afe..87f59cc671 100644 --- a/tests/integration/Core/Repository/SearchServiceTest.php +++ b/tests/integration/Core/Repository/SearchServiceTest.php @@ -682,6 +682,14 @@ public function getContentQuerySearches() ], $fixtureDir . 'Visibility.php', ], + [ + [ + 'query' => new Criterion\IsContainer(true), + 'sortClauses' => [new SortClause\ContentId()], + 'limit' => 5, + ], + $fixtureDir . 'IsContainerTrue.php', + ], [ [ 'query' => new Criterion\IsContainer(false), diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php new file mode 100644 index 0000000000..f2e4d13a39 --- /dev/null +++ b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php @@ -0,0 +1,69 @@ + [], + 'searchHits' => [ + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 4, + 'title' => 'Users', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 11, + 'title' => 'Members', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 12, + 'title' => 'Administrator users', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 13, + 'title' => 'Editors', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + SearchHit::__set_state([ + 'valueObject' => [ + 'id' => 41, + 'title' => 'Media', + ], + 'score' => null, + 'index' => null, + 'highlight' => null, + 'matchedTranslation' => 'eng-US', + ]), + ], + 'spellSuggestion' => null, + 'time' => 1, + 'timedOut' => null, + 'maxScore' => null, + 'totalCount' => 14, +]); From 94244d17f3d2fbfb49b0ff5f0be11ccbda8d6430 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 22 Feb 2024 11:48:55 +0100 Subject: [PATCH 06/15] phpstan fix --- .../Content/Common/Gateway/CriterionHandler/IsContainer.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php index a56482e609..0cc4fb6988 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -35,8 +35,9 @@ public function handle( Criterion $criterion, array $languageSettings ) { - /** @var bool $isContainer */ - $isContainer = reset($criterion->value); + /** @var array{bool} $criterionValue */ + $criterionValue = $criterion->value; + $isContainer = reset($criterionValue); $subSelect = $this->connection->createQueryBuilder(); $subSelect From 75292dd5887b48c8ba7140b398fb86c42cfec65d Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 11 Mar 2024 07:49:20 +0100 Subject: [PATCH 07/15] fix IsContainerQueryBuilder from Persistance --- .../Location/IsContainerQueryBuilder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php index 076f48c698..74dbcc890a 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Location/IsContainerQueryBuilder.php @@ -39,11 +39,13 @@ public function buildQueryConstraint( 'content.contentclass_id = contentclass.id', ); - $value = $criterion->value ? 1 : 0; + /** @var array{bool} $criterionValue */ + $criterionValue = $criterion->value; + $isContainer = reset($criterionValue); return $queryBuilder->expr()->in( 'contentclass.is_container', - $queryBuilder->createNamedParameter($value, ParameterType::INTEGER) + $queryBuilder->createNamedParameter((int)$isContainer, ParameterType::INTEGER) ); } } From 8e10d6fd780a1be45ccc79a0c91728327bae626b Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 11 Mar 2024 07:51:58 +0100 Subject: [PATCH 08/15] Add IsContainer tests in BaseRepositoryFilteringTestCase --- .../Repository/Filtering/BaseRepositoryFilteringTestCase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/Core/Repository/Filtering/BaseRepositoryFilteringTestCase.php b/tests/integration/Core/Repository/Filtering/BaseRepositoryFilteringTestCase.php index 9807765353..6118035a9a 100644 --- a/tests/integration/Core/Repository/Filtering/BaseRepositoryFilteringTestCase.php +++ b/tests/integration/Core/Repository/Filtering/BaseRepositoryFilteringTestCase.php @@ -239,6 +239,8 @@ public function getCriteriaForInitialData(): iterable Criterion\Operator::BETWEEN, [1080220197, 1448889046] ); + yield 'IsContainer=true' => new Criterion\IsContainer(true); + yield 'IsContainer=false' => new Criterion\IsContainer(false); yield 'IsUserBased=true' => new Criterion\IsUserBased(true); yield 'IsUserBased=false' => new Criterion\IsUserBased(false); yield 'IsUserEnabled=true' => new Criterion\IsUserEnabled(); From d7d7a712039e3c0569707320340607b35ba17020 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Mon, 11 Mar 2024 17:41:24 +0100 Subject: [PATCH 09/15] 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) ); } From d5e8104bc5b24911ad88617c9eb1ea37f685332e Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 5 Apr 2024 09:49:37 +0200 Subject: [PATCH 10/15] after CR --- .../Repository/Values/Content/Query/Criterion/IsContainer.php | 2 +- .../Content/Common/Gateway/CriterionHandler/IsContainer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php b/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php index 50011b3dd8..4a01a3a20a 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/IsContainer.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator\Specifications; use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion; -class IsContainer extends Criterion implements FilteringCriterion +final class IsContainer extends Criterion implements FilteringCriterion { public function __construct(bool $value = true) { diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php index 0cc4fb6988..4c13e76cb2 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -17,7 +17,7 @@ /** * Content type group criterion handler. */ -class IsContainer extends CriterionHandler +final class IsContainer extends CriterionHandler { public function accept(Criterion $criterion): bool { From 29867f59373ebb2ad5dd8f51b12c859b6c37ba27 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Fri, 5 Apr 2024 09:58:53 +0200 Subject: [PATCH 11/15] tests after CR --- .../Repository/_fixtures/Legacy/IsContainerFalse.php | 10 +++++----- .../Repository/_fixtures/Legacy/IsContainerTrue.php | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php index 7443ebe674..f2645e6790 100644 --- a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php +++ b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerFalse.php @@ -7,10 +7,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; -return SearchResult::__set_state([ +return new SearchResult([ 'facets' => [], 'searchHits' => [ - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 10, 'title' => 'Anonymous User', @@ -20,7 +20,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 14, 'title' => 'Administrator User', @@ -30,7 +30,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 52, 'title' => 'Common INI settings', @@ -40,7 +40,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 54, 'title' => 'Ibexa Demo Design (without demo content)', diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php index f2e4d13a39..52f30b9826 100644 --- a/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php +++ b/tests/integration/Core/Repository/_fixtures/Legacy/IsContainerTrue.php @@ -7,10 +7,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; -return SearchResult::__set_state([ +return new SearchResult([ 'facets' => [], 'searchHits' => [ - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 4, 'title' => 'Users', @@ -20,7 +20,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 11, 'title' => 'Members', @@ -30,7 +30,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 12, 'title' => 'Administrator users', @@ -40,7 +40,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 13, 'title' => 'Editors', @@ -50,7 +50,7 @@ 'highlight' => null, 'matchedTranslation' => 'eng-US', ]), - SearchHit::__set_state([ + new SearchHit([ 'valueObject' => [ 'id' => 41, 'title' => 'Media', From 4c5b1da07820a6040918938886c3dc9a0540b734 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Wed, 17 Apr 2024 11:10:36 +0200 Subject: [PATCH 12/15] remove needless class: from yaml --- .../settings/search_engines/legacy/criterion_handlers_common.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml b/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml index e4f87f22cf..2b5edd76c0 100644 --- a/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml +++ b/src/lib/Resources/settings/search_engines/legacy/criterion_handlers_common.yml @@ -146,7 +146,6 @@ services: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\IsContainer: parent: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler - class: Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\IsContainer tags: - {name: ibexa.search.legacy.gateway.criterion_handler.content} - {name: ibexa.search.legacy.gateway.criterion_handler.location} From 71a1ab01fda3c3d089c8bf12b10e1683f0c322c4 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 18 Apr 2024 10:14:27 +0200 Subject: [PATCH 13/15] Delete unnecessary comment --- .../Content/Common/Gateway/CriterionHandler/IsContainer.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php index 4c13e76cb2..d018371b84 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -14,9 +14,6 @@ use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; -/** - * Content type group criterion handler. - */ final class IsContainer extends CriterionHandler { public function accept(Criterion $criterion): bool From 1b96e0c95b95f75b616d48fd3ef03d68d9ea36c5 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 18 Apr 2024 11:59:23 +0200 Subject: [PATCH 14/15] Fix sonarcloud fixtures exclusion path --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index a6f00c520f..43ab56dedb 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1 +1 @@ -sonar.exclusions=**/Tests/**/_fixtures/* +sonar.exclusions=tests/**/_fixtures/**/* From eb5238031520a89cde2808c3cf41fd399fb07bb0 Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 18 Apr 2024 16:21:36 +0200 Subject: [PATCH 15/15] after CR --- .../Content/Common/Gateway/CriterionHandler/IsContainer.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php index d018371b84..80189c186e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway as ContentTypeGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -23,8 +24,6 @@ public function accept(Criterion $criterion): bool /** * @phpstan-param array{languages: string[]} $languageSettings - * - * @param array $languageSettings */ public function handle( CriteriaConverter $converter, @@ -41,7 +40,7 @@ public function handle( ->select( 'id' )->from( - 'ezcontentclass' + ContentTypeGateway::CONTENT_TYPE_TABLE )->where( $queryBuilder->expr()->eq( 'is_container',