From 625f7b740d95e7aefef6e4a10d00a9a1b3f5eb8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Tue, 10 Dec 2024 14:06:13 +0100 Subject: [PATCH] IBX-8534: Cleaned up deprecations (#456) For more details see https://issues.ibexa.co/browse/IBX-8534 and https://github.com/ibexa/core/pull/456 Key changes: * Removed deprecation from `SectionService::countAssignedContents` and `SectionService::count` methods, as they're used by AdminUI and there is no replacement for them * Removed deprecation from `\Ibexa\Core\FieldType\Image\Value::fromString` * Dropped \Ibexa\Core\Helper\FieldHelper::getFieldDefinition * Dropped \Ibexa\Core\FieldType\StorageGateway * Dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::STATUS_ARCHIVED * Dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::$isPublished * Dropped $name from bookmarks * Dropped \Ibexa\Contracts\Core\Persistence\Content\Handler::loadRelations * Dropped Identity contracts * Injected TransactionHandler into repository * Dropped imageValue::path * Dropped imageValue::path * Dropped \Ibexa\Core\FieldType\Image\Value::fromString * Dropped \Ibexa\Contracts\Core\Persistence\Content\LoadStruct * Dropped \Ibexa\Core\Persistence\Cache\PersistenceLogger::getCount * Dropped \Ibexa\Contracts\Core\Repository\PasswordHashService * Dropped Location::pathIdentificationString * Dropped markSubtreeModified & updateSubtreeModificationTime * Dropped \Ibexa\Contracts\Core\Persistence\FieldType\IsEmptyValue * Dropped Indexer::createSearchIndex * Dropped \Ibexa\Contracts\Core\Persistence\User\Handler::loadPoliciesByUserId * Dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsMainLocation::createFromQueryBuilder * Dropped \Ibexa\Core\Repository\Helper\RoleDomainMapper * Dropped Ibexa\Core\Repository\Helper\NameSchemaService * Dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Priority::createFromQueryBuilder * Dropped Location::SORT_FIELD_MODIFIED_SUBNODE * Replaced abstract Criterion with CriterionInterface --- phpstan-baseline.neon | 389 +----------------- .../Core/ApiLoader/RepositoryFactory.php | 6 +- .../Core/Command/CleanupVersionsCommand.php | 1 + src/bundle/Core/Command/ReindexCommand.php | 66 ++- .../BackgroundIndexingTerminateListener.php | 4 +- src/bundle/Core/Resources/config/helpers.yml | 2 +- .../Persistence/Bookmark/Bookmark.php | 9 - .../Persistence/Bookmark/CreateStruct.php | 9 - .../Persistence/Content/ContentInfo.php | 12 - src/contracts/Persistence/Content/Handler.php | 16 - .../Persistence/Content/LoadStruct.php | 49 --- .../Persistence/Content/Location.php | 11 - .../Content/Location/CreateStruct.php | 11 - .../Persistence/Content/Location/Handler.php | 13 - .../Content/Location/Trash/Handler.php | 5 +- src/contracts/Persistence/FieldType.php | 4 + .../Persistence/FieldType/IsEmptyValue.php | 25 -- src/contracts/Persistence/Handler.php | 32 -- src/contracts/Persistence/User/Handler.php | 12 - .../Decorator/SearchServiceDecorator.php | 6 +- .../PermissionCriterionResolver.php | 6 +- src/contracts/Repository/SearchService.php | 9 +- src/contracts/Repository/SectionService.php | 6 - .../Repository/Values/Content/Location.php | 8 - .../Repository/Values/Content/Query.php | 9 +- .../Query/Criterion/CompositeCriterion.php | 6 +- .../Criterion/Location/IsMainLocation.php | 10 - .../Query/Criterion/Location/Priority.php | 10 - .../Content/Query/Criterion/LogicalNot.php | 6 +- .../Query/Criterion/LogicalOperator.php | 26 +- .../Content/URLWildcard/Query/Criterion.php | 4 +- .../Values/Filter/FilteringCriterion.php | 4 +- .../Values/Trash/Query/Criterion.php | 4 +- src/contracts/Search/Handler.php | 13 +- src/contracts/User/Identity.php | 56 --- src/contracts/User/IdentityAware.php | 16 - .../Container/ApiLoader/RepositoryFactory.php | 8 +- src/lib/Event/ContentService.php | 2 +- src/lib/FieldType/Image/Type.php | 1 - src/lib/FieldType/Image/Value.php | 37 +- src/lib/FieldType/StorageGateway.php | 31 -- src/lib/Helper/FieldHelper.php | 26 +- .../RelationList/ParameterProvider.php | 2 +- src/lib/Persistence/Cache/ContentHandler.php | 17 - src/lib/Persistence/Cache/Handler.php | 24 -- src/lib/Persistence/Cache/LocationHandler.php | 9 - .../Persistence/Cache/PersistenceLogger.php | 10 - src/lib/Persistence/Cache/TrashHandler.php | 22 +- src/lib/Persistence/Cache/UserHandler.php | 10 - src/lib/Persistence/FieldType.php | 2 +- .../Bookmark/Gateway/DoctrineDatabase.php | 2 - .../Persistence/Legacy/Bookmark/Mapper.php | 2 - .../Persistence/Legacy/Content/Handler.php | 19 - .../Legacy/Content/Location/Gateway.php | 18 +- .../Location/Gateway/DoctrineDatabase.php | 30 +- .../Location/Gateway/ExceptionConversion.php | 15 +- .../Legacy/Content/Location/Handler.php | 22 - .../Legacy/Content/Location/Mapper.php | 2 - .../Legacy/Content/Location/Trash/Handler.php | 17 +- src/lib/Persistence/Legacy/Content/Mapper.php | 2 - .../Mapper/DoctrineGatewayDataMapper.php | 3 - src/lib/Persistence/Legacy/Handler.php | 38 -- src/lib/Persistence/Legacy/User/Handler.php | 20 - .../QueryType/BuiltIn/AbstractQueryType.php | 6 +- .../QueryType/BuiltIn/AncestorsQueryType.php | 4 +- .../QueryType/BuiltIn/ChildrenQueryType.php | 4 +- .../BuiltIn/GeoLocationQueryType.php | 4 +- .../BuiltIn/RelatedToContentQueryType.php | 3 +- .../QueryType/BuiltIn/SiblingsQueryType.php | 3 +- .../QueryType/BuiltIn/SubtreeQueryType.php | 4 +- src/lib/Repository/BookmarkService.php | 1 - src/lib/Repository/ContentService.php | 40 +- .../Repository/Helper/NameSchemaService.php | 191 --------- src/lib/Repository/Helper/Readme.md | 7 - .../Repository/Helper/RelationProcessor.php | 2 + .../Repository/Helper/RoleDomainMapper.php | 21 - src/lib/Repository/LocationService.php | 11 +- .../Repository/Mapper/ContentDomainMapper.php | 9 +- .../Permission/CachedPermissionService.php | 6 +- .../PermissionCriterionResolver.php | 8 +- src/lib/Repository/Repository.php | 17 +- src/lib/Repository/SearchService.php | 20 +- src/lib/Repository/SectionService.php | 6 - .../SiteAccessAware/SearchService.php | 6 +- src/lib/Repository/TrashService.php | 4 - .../Repository/User/PasswordHashService.php | 4 +- .../Resources/settings/repository/inner.yml | 2 +- .../ContentEventSubscriber.php | 5 +- src/lib/Search/Common/FieldNameResolver.php | 7 +- src/lib/Search/Common/IncrementalIndexer.php | 42 -- src/lib/Search/Common/Indexer.php | 10 - .../Common/Gateway/CriteriaConverter.php | 5 +- .../Common/Gateway/CriterionHandler.php | 7 +- .../CriterionHandler/CompositeCriterion.php | 8 +- .../Gateway/CriterionHandler/ContentId.php | 15 +- .../Gateway/CriterionHandler/ContentName.php | 6 +- .../CriterionHandler/ContentTypeGroupId.php | 15 +- .../CriterionHandler/ContentTypeId.php | 15 +- .../ContentTypeIdentifier.php | 15 +- .../Gateway/CriterionHandler/DateMetadata.php | 15 +- .../Common/Gateway/CriterionHandler/Field.php | 15 +- .../Gateway/CriterionHandler/FieldEmpty.php | 8 +- .../CriterionHandler/FieldRelation.php | 15 +- .../Gateway/CriterionHandler/FullText.php | 15 +- .../Gateway/CriterionHandler/IsContainer.php | 7 +- .../Gateway/CriterionHandler/IsUserBased.php | 8 +- .../CriterionHandler/IsUserEnabled.php | 8 +- .../Gateway/CriterionHandler/LanguageCode.php | 15 +- .../Gateway/CriterionHandler/LogicalAnd.php | 15 +- .../Gateway/CriterionHandler/LogicalNot.php | 15 +- .../Gateway/CriterionHandler/LogicalOr.php | 15 +- .../CriterionHandler/MapLocationDistance.php | 15 +- .../Gateway/CriterionHandler/MatchAll.php | 12 +- .../Gateway/CriterionHandler/MatchNone.php | 12 +- .../CriterionHandler/ObjectStateId.php | 15 +- .../ObjectStateIdentifier.php | 8 +- .../Gateway/CriterionHandler/RemoteId.php | 15 +- .../Gateway/CriterionHandler/SectionId.php | 15 +- .../CriterionHandler/SectionIdentifier.php | 8 +- .../Gateway/CriterionHandler/UserEmail.php | 8 +- .../Gateway/CriterionHandler/UserId.php | 8 +- .../Gateway/CriterionHandler/UserLogin.php | 8 +- .../Gateway/CriterionHandler/UserMetadata.php | 15 +- src/lib/Search/Legacy/Content/Gateway.php | 6 +- .../Gateway/CriterionHandler/Ancestor.php | 15 +- .../Gateway/CriterionHandler/LocationId.php | 15 +- .../CriterionHandler/LocationRemoteId.php | 15 +- .../CriterionHandler/ParentLocationId.php | 15 +- .../CriterionHandler/PermissionSubtree.php | 16 +- .../Gateway/CriterionHandler/Subtree.php | 15 +- .../Gateway/CriterionHandler/Visibility.php | 15 +- .../Content/Gateway/DoctrineDatabase.php | 13 +- .../Content/Gateway/ExceptionConversion.php | 4 +- src/lib/Search/Legacy/Content/Handler.php | 13 +- .../Legacy/Content/Location/Gateway.php | 5 +- .../Gateway/CriterionHandler/Ancestor.php | 15 +- .../CriterionHandler/Location/Depth.php | 15 +- .../Location/IsBookmarked.php | 6 +- .../Location/IsMainLocation.php | 15 +- .../CriterionHandler/Location/Priority.php | 15 +- .../Gateway/CriterionHandler/LocationId.php | 15 +- .../CriterionHandler/LocationRemoteId.php | 15 +- .../CriterionHandler/ParentLocationId.php | 15 +- .../Gateway/CriterionHandler/Subtree.php | 15 +- .../Gateway/CriterionHandler/Visibility.php | 15 +- .../Location/Gateway/DoctrineDatabase.php | 7 +- .../Location/Gateway/ExceptionConversion.php | 4 +- ...ackgroundIndexingTerminateListenerTest.php | 4 +- .../Legacy/BookmarkHandlerTest.php | 1 - .../Core/Repository/ContentServiceTest.php | 6 +- .../FieldType/ImageIntegrationTest.php | 2 - .../FieldType/SearchBaseIntegrationTest.php | 38 +- .../Repository/SearchServiceImageTest.php | 2 +- .../Repository/SearchServiceLocationTest.php | 1 + .../Core/Repository/SearchServiceTest.php | 11 +- tests/lib/FieldType/ImageTest.php | 8 +- tests/lib/Helper/FieldHelperTest.php | 7 +- .../ObjectStateLimitationTypeTest.php | 2 + .../Persistence/Cache/ContentHandlerTest.php | 1 - .../Persistence/Cache/LocationHandlerTest.php | 1 - .../Cache/PersistenceLoggerTest.php | 17 - .../lib/Persistence/Cache/UserHandlerTest.php | 1 - .../Bookmark/Gateway/DoctrineDatabaseTest.php | 3 +- .../Legacy/Bookmark/HandlerTest.php | 9 +- .../Legacy/Bookmark/MapperTest.php | 8 +- .../Legacy/Content/ContentHandlerTest.php | 14 +- .../Content/Gateway/DoctrineDatabaseTest.php | 1 - .../Location/Gateway/DoctrineDatabaseTest.php | 24 -- .../Legacy/Content/Location/MapperTest.php | 2 - .../Content/Location/TrashHandlerTest.php | 17 +- .../Legacy/Content/LocationHandlerTest.php | 30 -- .../extract_content_from_rows_result.php | 1 - .../Legacy/User/UserHandlerTest.php | 25 -- .../Decorator/ContentServiceDecoratorTest.php | 2 +- tests/lib/Repository/LocationServiceTest.php | 4 +- tests/lib/Repository/Service/Mock/Base.php | 14 +- .../Repository/Service/Mock/ContentTest.php | 6 - .../Service/Mock/RepositoryTest.php | 20 +- .../Repository/Service/Mock/UrlAliasTest.php | 10 +- .../Repository/Values/Filter/FilterTest.php | 6 +- 180 files changed, 578 insertions(+), 2108 deletions(-) delete mode 100644 src/contracts/Persistence/Content/LoadStruct.php delete mode 100644 src/contracts/Persistence/FieldType/IsEmptyValue.php delete mode 100644 src/contracts/User/Identity.php delete mode 100644 src/contracts/User/IdentityAware.php delete mode 100644 src/lib/FieldType/StorageGateway.php delete mode 100644 src/lib/Repository/Helper/NameSchemaService.php delete mode 100644 src/lib/Repository/Helper/Readme.md delete mode 100644 src/lib/Repository/Helper/RoleDomainMapper.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 12c01dece8..7dd0093d52 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -45,21 +45,6 @@ parameters: count: 1 path: src/bundle/Core/Command/CleanupVersionsCommand.php - - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Core/Command/CleanupVersionsCommand.php - - - - message: "#^Parameter \\#1 \\$array of function array_slice expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Core/Command/CleanupVersionsCommand.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Core/Command/CleanupVersionsCommand.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Helper\\\\HelperInterface\\:\\:ask\\(\\)\\.$#" count: 1 @@ -5070,11 +5055,6 @@ parameters: count: 1 path: src/contracts/Persistence/Content/Location/Handler.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\\\Handler\\:\\:markSubtreeModified\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Persistence/Content/Location/Handler.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\\\Handler\\:\\:setSectionForSubtree\\(\\) has no return type specified\\.$#" count: 1 @@ -5280,21 +5260,6 @@ parameters: count: 1 path: src/contracts/Persistence/Filter/LazyListIterator.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Handler\\:\\:beginTransaction\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Persistence/Handler.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Handler\\:\\:commit\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Persistence/Handler.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Handler\\:\\:rollback\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Persistence/Handler.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Notification\\\\CreateStruct\\:\\:\\$data type has no value type specified in iterable type array\\.$#" count: 1 @@ -6900,56 +6865,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/Content/Query/Criterion/FullText.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\IsMainLocation\\:\\:createFromQueryBuilder\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\IsMainLocation\\:\\:createFromQueryBuilder\\(\\) has parameter \\$operator with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\IsMainLocation\\:\\:createFromQueryBuilder\\(\\) has parameter \\$target with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\IsMainLocation\\:\\:createFromQueryBuilder\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\Priority\\:\\:createFromQueryBuilder\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\Priority\\:\\:createFromQueryBuilder\\(\\) has parameter \\$operator with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\Priority\\:\\:createFromQueryBuilder\\(\\) has parameter \\$target with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\Location\\\\Priority\\:\\:createFromQueryBuilder\\(\\) has parameter \\$value with no type specified\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php - - - - message: "#^PHPDoc tag @param references unknown parameter\\: \\$criteria$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalOperator\\:\\:getSpecifications\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Repository/Values/Content/Query/Criterion/LogicalOperator.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\MapLocationDistance\\:\\:\\$boost type has no value type specified in iterable type array\\.$#" count: 1 @@ -7210,21 +7125,6 @@ parameters: count: 1 path: src/contracts/Repository/Values/Filter/Filter.php - - - message: "#^Parameter \\#1 \\$criteria of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalAnd constructor expects array\\, array\\ given\\.$#" - count: 1 - path: src/contracts/Repository/Values/Filter/Filter.php - - - - message: "#^Parameter \\#1 \\$criteria of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalOr constructor expects array\\, array\\ given\\.$#" - count: 1 - path: src/contracts/Repository/Values/Filter/Filter.php - - - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalOperator\\:\\:\\$criteria \\(array\\\\) does not accept array\\\\.$#" - count: 2 - path: src/contracts/Repository/Values/Filter/Filter.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Notification\\\\CreateStruct\\:\\:\\$data type has no value type specified in iterable type array\\.$#" count: 1 @@ -7505,41 +7405,6 @@ parameters: count: 1 path: src/contracts/Test/Repository/SetupFactory/Legacy.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:addInformation\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:addInformation\\(\\) has parameter \\$information with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:getInformation\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:replaceInformation\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:replaceInformation\\(\\) has parameter \\$information with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\Identity\\:\\:setInformation\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/User/Identity.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\User\\\\IdentityAware\\:\\:setIdentity\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/User/IdentityAware.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\Variation\\\\VariationHandler\\:\\:getVariation\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" count: 1 @@ -8410,11 +8275,6 @@ parameters: count: 1 path: src/lib/Base/Utils/DeprecationWarnerInterface.php - - - message: "#^Parameter \\#1 \\$locations of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Events\\\\Content\\\\DeleteContentEvent constructor expects array, array\\|iterable\\ given\\.$#" - count: 1 - path: src/lib/Event/ContentService.php - - message: "#^Method Ibexa\\\\Core\\\\Event\\\\TokenService\\:\\:getToken\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Token\\\\Token but returns Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Token\\\\Token\\|string\\.$#" count: 1 @@ -9720,11 +9580,6 @@ parameters: count: 1 path: src/lib/FieldType/Selection/Type.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\StorageGateway\\:\\:setConnection\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/FieldType/StorageGateway.php - - message: "#^Parameter \\#1 \\$string of function mb_substr expects string, string\\|false given\\.$#" count: 1 @@ -10200,11 +10055,6 @@ parameters: count: 1 path: src/lib/Helper/FieldHelper.php - - - message: "#^Method Ibexa\\\\Core\\\\Helper\\\\FieldHelper\\:\\:getFieldDefinition\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinition but returns Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinition\\|null\\.$#" - count: 1 - path: src/lib/Helper/FieldHelper.php - - message: "#^Method Ibexa\\\\Core\\\\Helper\\\\FieldsGroups\\\\ArrayTranslatorFieldsGroupsList\\:\\:__construct\\(\\) has parameter \\$groups with no value type specified in iterable type array\\.$#" count: 1 @@ -11095,11 +10945,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, iterable\\ given\\.$#" - count: 1 - path: src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php - - message: "#^Cannot call method diff\\(\\) on DateTimeImmutable\\|null\\.$#" count: 1 @@ -13485,21 +13330,6 @@ parameters: count: 1 path: src/lib/Persistence/Cache/ContentTypeHandler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\Handler\\:\\:beginTransaction\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Cache/Handler.php - - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\Handler\\:\\:commit\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Cache/Handler.php - - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\Handler\\:\\:rollback\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Cache/Handler.php - - message: "#^Return type \\(Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\URLHandler\\) of method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\Handler\\:\\:urlHandler\\(\\) should be compatible with return type \\(Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\URL\\\\Handler\\) of method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Handler\\:\\:urlHandler\\(\\)$#" count: 1 @@ -13625,11 +13455,6 @@ parameters: count: 1 path: src/lib/Persistence/Cache/LocationHandler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\LocationHandler\\:\\:markSubtreeModified\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Cache/LocationHandler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Cache\\\\LocationHandler\\:\\:setSectionForSubtree\\(\\) has no return type specified\\.$#" count: 1 @@ -15790,11 +15615,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Location/Handler.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Handler\\:\\:markSubtreeModified\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Location/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Handler\\:\\:move\\(\\) should return bool but return statement is missing\\.$#" count: 1 @@ -15835,16 +15655,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Location/Handler.php - - - message: "#^Parameter \\#1 \\$nodeId of method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Gateway\\:\\:getBasicNodeData\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Location/Handler.php - - - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\\\CreateStruct\\:\\:\\$pathIdentificationString \\(string\\) does not accept string\\|null\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Location/Handler.php - - message: "#^Variable \\$copiedSubtreeRootLocation might not be defined\\.$#" count: 2 @@ -15870,11 +15680,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/Location/Mapper.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Handler\\:\\:changeMainLocation\\(\\) invoked with 4 parameters, 2 required\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Trash\\\\Handler\\:\\:loadTrashItem\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\\\Trashed but returns Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\.$#" count: 1 @@ -17635,21 +17440,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Filter/SortClauseVisitor.php - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Handler\\:\\:beginTransaction\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Handler.php - - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Handler\\:\\:commit\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Handler.php - - - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Handler\\:\\:rollback\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/Handler.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Notification\\\\Gateway\\:\\:getNotificationById\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -18985,11 +18775,6 @@ parameters: count: 1 path: src/lib/Repository/ContentService.php - - - message: "#^Parameter \\#3 \\$prioritizedLanguages of method Ibexa\\\\Core\\\\Repository\\\\Mapper\\\\ContentDomainMapper\\:\\:buildContentDomainObjectFromPersistence\\(\\) expects array\\, array\\\\|null given\\.$#" - count: 1 - path: src/lib/Repository/ContentService.php - - message: "#^Parameter \\#5 \\$fieldDefinitionId of method Ibexa\\\\Core\\\\Repository\\\\Helper\\\\RelationProcessor\\:\\:appendFieldRelations\\(\\) expects string, int given\\.$#" count: 2 @@ -19065,31 +18850,6 @@ parameters: count: 1 path: src/lib/Repository/ContentTypeService.php - - - message: "#^Cannot access property \\$fieldTypeIdentifier on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinition\\|null\\.$#" - count: 1 - path: src/lib/Repository/Helper/NameSchemaService.php - - - - message: "#^Parameter \\#2 \\$fieldDefinition of method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldType\\:\\:getName\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinition, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\FieldDefinition\\|null given\\.$#" - count: 1 - path: src/lib/Repository/Helper/NameSchemaService.php - - - - message: "#^Argument of an invalid type array\\\\|Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/lib/Repository/Helper/RelationProcessor.php - - - - message: "#^Cannot access property \\$destinationContentInfo on array\\\\|Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\.$#" - count: 1 - path: src/lib/Repository/Helper/RelationProcessor.php - - - - message: "#^Cannot access property \\$id on array\\\\|Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\.$#" - count: 1 - path: src/lib/Repository/Helper/RelationProcessor.php - - message: "#^Cannot call method error\\(\\) on Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" count: 1 @@ -19455,11 +19215,6 @@ parameters: count: 1 path: src/lib/Repository/Permission/CachedPermissionService.php - - - message: "#^Property Ibexa\\\\Core\\\\Repository\\\\Permission\\\\CachedPermissionService\\:\\:\\$permissionCriterion \\(bool\\|Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\) does not accept null\\.$#" - count: 1 - path: src/lib/Repository/Permission/CachedPermissionService.php - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Permission\\\\LimitationService\\:\\:__construct\\(\\) has parameter \\$limitationTypes with no value type specified in iterable type Traversable\\.$#" count: 1 @@ -19480,26 +19235,11 @@ parameters: count: 1 path: src/lib/Repository/Permission/PermissionCriterionResolver.php - - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Permission\\\\PermissionCriterionResolver\\:\\:getPermissionsCriterion\\(\\) should return bool\\|Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion but returns Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\CriterionInterface\\.$#" - count: 1 - path: src/lib/Repository/Permission/PermissionCriterionResolver.php - - message: "#^PHPDoc tag @var does not specify variable name\\.$#" count: 1 path: src/lib/Repository/Permission/PermissionCriterionResolver.php - - - message: "#^Parameter \\#1 \\$criteria of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalAnd constructor expects array\\, array\\ given\\.$#" - count: 2 - path: src/lib/Repository/Permission/PermissionCriterionResolver.php - - - - message: "#^Parameter \\#1 \\$criteria of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\LogicalOr constructor expects array\\, array\\ given\\.$#" - count: 2 - path: src/lib/Repository/Permission/PermissionCriterionResolver.php - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\Permission\\\\PermissionResolver\\:\\:__construct\\(\\) has parameter \\$policyMap with no value type specified in iterable type array\\.$#" count: 1 @@ -19735,11 +19475,6 @@ parameters: count: 1 path: src/lib/Repository/Repository.php - - - message: "#^Parameter \\#4 \\$nameSchemaService of class Ibexa\\\\Core\\\\Repository\\\\LocationService constructor expects Ibexa\\\\Core\\\\Repository\\\\Helper\\\\NameSchemaService, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\NameSchema\\\\NameSchemaServiceInterface given\\.$#" - count: 1 - path: src/lib/Repository/Repository.php - - message: "#^Parameter \\#5 \\$backgroundIndexer of class Ibexa\\\\Core\\\\Repository\\\\SearchService constructor expects Ibexa\\\\Core\\\\Search\\\\Common\\\\BackgroundIndexer, Ibexa\\\\Core\\\\Search\\\\Common\\\\BackgroundIndexer\\|null given\\.$#" count: 1 @@ -19755,11 +19490,6 @@ parameters: count: 1 path: src/lib/Repository/Repository.php - - - message: "#^Property Ibexa\\\\Core\\\\Repository\\\\Repository\\:\\:\\$thumbnailStrategy is never read, only written\\.$#" - count: 1 - path: src/lib/Repository/Repository.php - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\RoleAssignment\\:\\:\\$id\\.$#" count: 1 @@ -20865,11 +20595,6 @@ parameters: count: 1 path: src/lib/Search/Common/FieldValueMapper/StringMapper.php - - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Common\\\\IncrementalIndexer\\:\\:createSearchIndex\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Search/Common/IncrementalIndexer.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Common\\\\IncrementalIndexer\\:\\:purge\\(\\) has no return type specified\\.$#" count: 1 @@ -20880,11 +20605,6 @@ parameters: count: 1 path: src/lib/Search/Common/IncrementalIndexer.php - - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Common\\\\Indexer\\:\\:createSearchIndex\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Search/Common/Indexer.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Common\\\\Indexer\\:\\:getContentDbFieldsStmt\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#" count: 1 @@ -20920,11 +20640,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\:\\:\\$criteria\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/CompositeCriterion.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\CompositeCriterion\\:\\:handle\\(\\) has parameter \\$languageSettings with no value type specified in iterable type array\\.$#" count: 1 @@ -21180,11 +20895,6 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\:\\:\\$matchAlwaysAvailable\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php - - message: "#^Cannot call method getBitAndComparisonExpression\\(\\) on Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\|null\\.$#" count: 1 @@ -21200,31 +20910,16 @@ parameters: count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\:\\:\\$criteria\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\LogicalAnd\\:\\:handle\\(\\) has parameter \\$languageSettings with no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\:\\:\\$criteria\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\LogicalNot\\:\\:handle\\(\\) has parameter \\$languageSettings with no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\:\\:\\$criteria\\.$#" - count: 1 - path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php - - message: "#^Method Ibexa\\\\Core\\\\Search\\\\Legacy\\\\Content\\\\Common\\\\Gateway\\\\CriterionHandler\\\\LogicalOr\\:\\:handle\\(\\) has parameter \\$languageSettings with no value type specified in iterable type array\\.$#" count: 1 @@ -26700,11 +26395,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadVersions\\(\\) should return array\\ but returns iterable\\\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadVersionsAfterDeletingTwoDrafts\\(\\) has no return type specified\\.$#" count: 1 @@ -26965,11 +26655,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" - count: 2 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Parameter \\#2 \\$actualAliases of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:assertAliasesCorrect\\(\\) expects array, iterable\\ given\\.$#" count: 4 @@ -29450,11 +29135,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\SearchBaseIntegrationTest\\:\\:doModifyField\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\SearchBaseIntegrationTest\\:\\:findProvider\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -29480,11 +29160,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\SearchBaseIntegrationTest\\:\\:modifyFieldCriterion\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\SearchBaseIntegrationTest\\:\\:modifyFieldSortClause\\(\\) has no return type specified\\.$#" count: 1 @@ -36455,11 +36130,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/SearchServiceTest.php - - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit\\:\\:\\$valueObject \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\) does not accept array\\\\.$#" - count: 2 - path: tests/integration/Core/Repository/SearchServiceTest.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 3 @@ -46425,11 +46095,6 @@ parameters: count: 1 path: tests/lib/Pagination/ContentSearchHitAdapterTest.php - - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\:\\:\\$query \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\CriterionInterface&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/Pagination/ContentSearchHitAdapterTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Pagination\\\\LocationSearchAdapterTest\\:\\:getAdapter\\(\\) has parameter \\$languageFilter with no value type specified in iterable type array\\.$#" count: 1 @@ -46460,11 +46125,6 @@ parameters: count: 1 path: tests/lib/Pagination/LocationSearchHitAdapterTest.php - - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\:\\:\\$query \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\CriterionInterface&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/Pagination/LocationSearchHitAdapterTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Cache\\\\AbstractBaseHandlerTest\\:\\:getCacheItem\\(\\) has parameter \\$key with no type specified\\.$#" count: 1 @@ -47090,16 +46750,6 @@ parameters: count: 1 path: tests/lib/Persistence/Cache/PersistenceLoggerTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Cache\\\\PersistenceLoggerTest\\:\\:testGetCount\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Cache/PersistenceLoggerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Cache\\\\PersistenceLoggerTest\\:\\:testGetCountValues\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Cache/PersistenceLoggerTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Cache\\\\PersistenceLoggerTest\\:\\:testGetName\\(\\) has no return type specified\\.$#" count: 1 @@ -47605,11 +47255,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\ContentHandlerTest\\:\\:testLoadRelations\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\ContentHandlerTest\\:\\:testLoadReverseRelations\\(\\) has no return type specified\\.$#" count: 1 @@ -49280,11 +48925,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Gateway\\\\DoctrineDatabaseTest\\:\\:testUpdateSubtreeModificationTime\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php - - message: "#^Parameter \\#2 \\$y of method Doctrine\\\\DBAL\\\\Query\\\\Expression\\\\ExpressionBuilder\\:\\:in\\(\\) expects array\\\\|string, array\\ given\\.$#" count: 11 @@ -49492,7 +49132,7 @@ parameters: - message: "#^Call to an undefined method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Handler\\:\\:expects\\(\\)\\.$#" - count: 4 + count: 1 path: tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php - @@ -49552,7 +49192,7 @@ parameters: - message: "#^Call to an undefined method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\Location\\\\Gateway\\:\\:expects\\(\\)\\.$#" - count: 22 + count: 20 path: tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php - @@ -49620,11 +49260,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\LocationHandlerTest\\:\\:testMarkSubtreeModified\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\Content\\\\LocationHandlerTest\\:\\:testMoveSubtree\\(\\) has no return type specified\\.$#" count: 1 @@ -52940,11 +52575,6 @@ parameters: count: 1 path: tests/lib/Persistence/Legacy/User/UserHandlerTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\User\\\\UserHandlerTest\\:\\:testLoadPoliciesForUser\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Persistence/Legacy/User/UserHandlerTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Persistence\\\\Legacy\\\\User\\\\UserHandlerTest\\:\\:testLoadRole\\(\\) has no return type specified\\.$#" count: 1 @@ -53550,11 +53180,6 @@ parameters: count: 1 path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - - message: "#^Parameter \\#1 \\$contentIds of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentService\\:\\:loadContentInfoList\\(\\) expects array\\, array\\ given\\.$#" - count: 1 - path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - message: "#^Parameter \\#2 \\$locationCreateStructs of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentService\\:\\:createContent\\(\\) expects array\\, array\\ given\\.$#" count: 1 @@ -58435,16 +58060,6 @@ parameters: count: 1 path: tests/lib/Repository/Values/Filter/FilterTest.php - - - message: "#^Parameter \\#1 \\$criterion of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Filter\\\\Filter\\:\\:orWithCriterion\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Filter\\\\FilteringCriterion, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion given\\.$#" - count: 1 - path: tests/lib/Repository/Values/Filter/FilterTest.php - - - - message: "#^Parameter \\#1 \\$criterion of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Filter\\\\Filter\\:\\:withCriterion\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Filter\\\\FilteringCriterion, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion given\\.$#" - count: 1 - path: tests/lib/Repository/Values/Filter/FilterTest.php - - message: "#^Parameter \\#1 \\$value of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\RemoteId constructor expects array\\\\|string, int given\\.$#" count: 1 diff --git a/src/bundle/Core/ApiLoader/RepositoryFactory.php b/src/bundle/Core/ApiLoader/RepositoryFactory.php index dc2abfed0a..55a2d3af4c 100644 --- a/src/bundle/Core/ApiLoader/RepositoryFactory.php +++ b/src/bundle/Core/ApiLoader/RepositoryFactory.php @@ -11,12 +11,12 @@ use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler; use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; +use Ibexa\Contracts\Core\Persistence\TransactionHandler; use Ibexa\Contracts\Core\Repository\LanguageResolver; use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PasswordHashService; use Ibexa\Contracts\Core\Repository\PermissionService; use Ibexa\Contracts\Core\Repository\Repository; -use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy; use Ibexa\Contracts\Core\Repository\Validator\ContentValidator; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; @@ -81,7 +81,6 @@ public function buildRepository( RelationProcessor $relationProcessor, FieldTypeRegistry $fieldTypeRegistry, PasswordHashService $passwordHashService, - ThumbnailStrategy $thumbnailStrategy, ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory, Mapper\ContentDomainMapper $contentDomainMapper, Mapper\ContentTypeDomainMapper $contentTypeDomainMapper, @@ -95,6 +94,7 @@ public function buildRepository( PasswordValidatorInterface $passwordValidator, ConfigResolverInterface $configResolver, NameSchemaServiceInterface $nameSchemaService, + TransactionHandler $transactionHandler ): Repository { $config = $this->repositoryConfigurationProvider->getRepositoryConfig(); @@ -105,7 +105,6 @@ public function buildRepository( $relationProcessor, $fieldTypeRegistry, $passwordHashService, - $thumbnailStrategy, $proxyDomainMapperFactory, $contentDomainMapper, $contentTypeDomainMapper, @@ -120,6 +119,7 @@ public function buildRepository( $passwordValidator, $configResolver, $nameSchemaService, + $transactionHandler, [ 'role' => [ 'policyMap' => $this->policyMap, diff --git a/src/bundle/Core/Command/CleanupVersionsCommand.php b/src/bundle/Core/Command/CleanupVersionsCommand.php index 67efa6bbbe..1c116d080c 100644 --- a/src/bundle/Core/Command/CleanupVersionsCommand.php +++ b/src/bundle/Core/Command/CleanupVersionsCommand.php @@ -177,6 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $contentInfo, $removeAll ? null : $this->mapStatusToVersionInfoStatus($status) ); + $versions = iterator_to_array($versions); $versionsCount = count($versions); $output->writeln(sprintf( diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index 6481e83fe9..caf77c5a73 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -14,7 +14,6 @@ use Ibexa\Contracts\Core\Persistence\Content\Location\Handler; use Ibexa\Contracts\Core\Search\Content\IndexerGateway; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; -use Ibexa\Core\Search\Common\IncrementalIndexer; use Ibexa\Core\Search\Common\Indexer; use Psr\Log\LoggerInterface; use RuntimeException; @@ -191,48 +190,31 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new InvalidArgumentException('--iteration-count', "The value must be > 0, you provided '{$iterationCount}'"); } - if (!$this->searchIndexer instanceof IncrementalIndexer) { - $output->writeln(<<searchIndexer->createSearchIndex($output, (int) $iterationCount, !$commit); - } else { - if (\in_array($input->getOption('processes'), ['0', '1'])) { - $io = new SymfonyStyle($input, $output); - $xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled'; - $memoryLimit = ini_get('memory_limit'); - - $io->warning(<<confirm('Continue?', true)) { - return self::SUCCESS; - } - } + if (\in_array($input->getOption('processes'), ['0', '1'])) { + $io = new SymfonyStyle($input, $output); + $xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled'; + $memoryLimit = ini_get('memory_limit'); + + $io->warning(<<writeln('Re-indexing started for search engine: ' . $this->searchIndexer->getName()); - $output->writeln(''); + For optimal performance, before running this command, make sure that: + - the xdebug extension is disabled (you have it $xdebugState), + - you're running the command in "prod" environment (default: dev), + - memory limit for big databases is set to "-1" or an adequately high value (your value: $memoryLimit), + - --iteration-count is low enough (default: 50), + - number of processes for parallel batch operations is high enough (default: 'auto' is a good choice). + EOT); - return $this->indexIncrementally($input, $output, $iterationCount, $commit); + if (!$io->confirm('Continue?', true)) { + return self::SUCCESS; + } } - return self::SUCCESS; + $output->writeln('Re-indexing started for search engine: ' . get_class($this->searchIndexer)); + $output->writeln(''); + + return $this->indexIncrementally($input, $output, $iterationCount, $commit); } /** @@ -253,7 +235,7 @@ protected function indexIncrementally( $this->searchIndexer->updateSearchIndex($contentIds, $commit); - return 0; + return self::SUCCESS; } if ($since = $input->getOption('since')) { @@ -278,7 +260,7 @@ protected function indexIncrementally( if (!$count) { $output->writeln('Could not find any items to index, aborting.'); - return 1; + return self::FAILURE; } $iterations = ceil($count / $iterationCount); @@ -326,7 +308,7 @@ protected function indexIncrementally( // clear leftover progress bar parts $progress->clear(); - return 0; + return self::SUCCESS; } /** diff --git a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php index 515d0cad0a..5301a1a020 100644 --- a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php +++ b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php @@ -82,7 +82,7 @@ public function reindex() try { // In case version has changed we make sure to fetch fresh ContentInfo $contentInfo = $contentHandler->loadContentInfo($contentInfo->id); - if ($contentInfo->isPublished) { + if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) { $this->searchHandler->indexContent( $contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo) ); @@ -109,7 +109,7 @@ public function reindex() try { // In case version has changed we make sure to fetch fresh ContentInfo $contentInfo = $contentHandler->loadContentInfo($location->contentId); - if ($contentInfo->isPublished) { + if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) { $this->searchHandler->indexContent( $contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo) ); diff --git a/src/bundle/Core/Resources/config/helpers.yml b/src/bundle/Core/Resources/config/helpers.yml index 7683d75494..b4b52a4bc0 100644 --- a/src/bundle/Core/Resources/config/helpers.yml +++ b/src/bundle/Core/Resources/config/helpers.yml @@ -13,7 +13,7 @@ services: - "@?logger" Ibexa\Core\Helper\FieldHelper: - arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.content_type', '@ibexa.api.service.field_type'] + arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.field_type'] Ibexa\Core\Helper\ContentPreviewHelper: arguments: ["@event_dispatcher", '@Ibexa\Core\MVC\Symfony\SiteAccess\Router'] diff --git a/src/contracts/Persistence/Bookmark/Bookmark.php b/src/contracts/Persistence/Bookmark/Bookmark.php index e1d7fbbe9a..822e2ff48c 100644 --- a/src/contracts/Persistence/Bookmark/Bookmark.php +++ b/src/contracts/Persistence/Bookmark/Bookmark.php @@ -19,15 +19,6 @@ class Bookmark extends ValueObject */ public $id; - /** - * Name of the bookmarked location. - * - * @deprecated Property is here purely for BC with 5.x. - * - * @var string - */ - public $name; - /** * ID of the bookmarked Location. * diff --git a/src/contracts/Persistence/Bookmark/CreateStruct.php b/src/contracts/Persistence/Bookmark/CreateStruct.php index 8949a24920..ef013f1cf2 100644 --- a/src/contracts/Persistence/Bookmark/CreateStruct.php +++ b/src/contracts/Persistence/Bookmark/CreateStruct.php @@ -12,15 +12,6 @@ class CreateStruct extends ValueObject { - /** - * Name of the bookmarked location. - * - * @deprecated Property is here purely for BC with 5.x. - * - * @var string - */ - public $name; - /** * ID of the bookmarked Location. * diff --git a/src/contracts/Persistence/Content/ContentInfo.php b/src/contracts/Persistence/Content/ContentInfo.php index 0458b145b8..cfc27c5cac 100644 --- a/src/contracts/Persistence/Content/ContentInfo.php +++ b/src/contracts/Persistence/Content/ContentInfo.php @@ -20,9 +20,6 @@ class ContentInfo extends ValueObject public const STATUS_PUBLISHED = 1; public const STATUS_TRASHED = 2; - /** @deprecated Use {@see ContentInfo::STATUS_TRASHED} */ - public const STATUS_ARCHIVED = self::STATUS_TRASHED; - /** * Content's unique ID. * @@ -59,15 +56,6 @@ class ContentInfo extends ValueObject */ public $currentVersionNo; - /** - * @deprecated Use {@see ContentInfo::$status} (with value {@see ContentInfo::STATUS_PUBLISHED}) - * - * Flag indicating if content is currently published. - * - * @var bool - */ - public $isPublished; - /** * Content owner's id. * diff --git a/src/contracts/Persistence/Content/Handler.php b/src/contracts/Persistence/Content/Handler.php index 7eb7758dd5..31e2cba5c7 100644 --- a/src/contracts/Persistence/Content/Handler.php +++ b/src/contracts/Persistence/Content/Handler.php @@ -281,22 +281,6 @@ public function loadRelation(int $relationId): Relation; */ public function removeRelation($relationId, $type, ?int $destinationContentId = null); - /** - * Loads relations from $sourceContentId. Optionally, loads only those with $type and $sourceContentVersionNo. - * - * @deprecated 4.5.7 It will be removed in 5.0. Use {@see \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList()} instead. - * - * @param mixed $sourceContentId Source Content ID - * @param mixed|null $sourceContentVersionNo Source Content Version, null if not specified - * @param int|null $type {@see \Ibexa\Contracts\Core\Repository\Values\Content\Relation::COMMON, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::EMBED, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::LINK, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::FIELD} - * - * @return \Ibexa\Contracts\Core\Persistence\Content\Relation[] - */ - public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null); - /** * Counts all outgoing relations for the given version. */ diff --git a/src/contracts/Persistence/Content/LoadStruct.php b/src/contracts/Persistence/Content/LoadStruct.php deleted file mode 100644 index 9b1c2b1390..0000000000 --- a/src/contracts/Persistence/Content/LoadStruct.php +++ /dev/null @@ -1,49 +0,0 @@ -totalCount will ignore limit and offset and representing the total amount of trashed items * matching the criterion. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null $criterion * @param int $offset Offset to start listing from, 0 by default * @param int $limit Limit for the listing. Null by default (no limit) * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $sort * * @return \Ibexa\Contracts\Core\Persistence\Content\Location\Trashed[]|\Ibexa\Contracts\Core\Persistence\Content\Location\Trash\TrashResult */ - public function findTrashItems(Criterion $criterion = null, $offset = 0, $limit = null, array $sort = null); + public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null); /** * Empties the trash diff --git a/src/contracts/Persistence/FieldType.php b/src/contracts/Persistence/FieldType.php index 6df6bdfcc4..342a990c5d 100644 --- a/src/contracts/Persistence/FieldType.php +++ b/src/contracts/Persistence/FieldType.php @@ -7,6 +7,8 @@ namespace Ibexa\Contracts\Core\Persistence; +use Ibexa\Contracts\Core\Persistence\Content\FieldValue; + /** * The field type interface which field types available to storage engines have to implement. * @@ -20,4 +22,6 @@ interface FieldType * @return \Ibexa\Contracts\Core\Persistence\Content\FieldValue */ public function getEmptyValue(); + + public function isEmptyValue(FieldValue $fieldValue): bool; } diff --git a/src/contracts/Persistence/FieldType/IsEmptyValue.php b/src/contracts/Persistence/FieldType/IsEmptyValue.php deleted file mode 100644 index 969bbf59ce..0000000000 --- a/src/contracts/Persistence/FieldType/IsEmptyValue.php +++ /dev/null @@ -1,25 +0,0 @@ -beginTransaction()} - */ - public function beginTransaction(); - - /** - * Commit transaction. - * - * Commit transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - * - * @deprecated Since 5.3 {@use transactionHandler()->commit()} - */ - public function commit(); - - /** - * Rollback transaction. - * - * Rollback transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - * - * @deprecated Since 5.3 {@use transactionHandler()->rollback()} - */ - public function rollback(); } diff --git a/src/contracts/Persistence/User/Handler.php b/src/contracts/Persistence/User/Handler.php index db0f71b2b4..c4df19195f 100644 --- a/src/contracts/Persistence/User/Handler.php +++ b/src/contracts/Persistence/User/Handler.php @@ -305,18 +305,6 @@ public function updatePolicy(Policy $policy); */ public function deletePolicy($policyId, $roleId); - /** - * Returns the user policies associated with the user (including inherited policies from user groups). - * - * @deprecated Since 6.8, not currently in use as permission system needs to know about role assignment limitations. - * - * @param mixed $userId - * In legacy storage engine this is the content object id roles are assigned to in ezuser_role. - * - * @return \Ibexa\Contracts\Core\Persistence\User\Policy[] - */ - public function loadPoliciesByUserId($userId); - /** * Assigns role to a user or user group with given limitations. * diff --git a/src/contracts/Repository/Decorator/SearchServiceDecorator.php b/src/contracts/Repository/Decorator/SearchServiceDecorator.php index f193b52204..ba9478a8cb 100644 --- a/src/contracts/Repository/Decorator/SearchServiceDecorator.php +++ b/src/contracts/Repository/Decorator/SearchServiceDecorator.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; abstract class SearchServiceDecorator implements SearchService @@ -42,7 +42,7 @@ public function findContentInfo( } public function findSingle( - Criterion $filter, + CriterionInterface $filter, array $languageFilter = [], bool $filterOnUserPermissions = true ): Content { @@ -53,7 +53,7 @@ public function suggest( string $prefix, array $fieldPaths = [], int $limit = 10, - Criterion $filter = null + CriterionInterface $filter = null ) { return $this->innerService->suggest($prefix, $fieldPaths, $limit, $filter); } diff --git a/src/contracts/Repository/PermissionCriterionResolver.php b/src/contracts/Repository/PermissionCriterionResolver.php index 0baba717d4..10a447c544 100644 --- a/src/contracts/Repository/PermissionCriterionResolver.php +++ b/src/contracts/Repository/PermissionCriterionResolver.php @@ -8,7 +8,7 @@ namespace Ibexa\Contracts\Core\Repository; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * This service provides methods for resolving criterion permissions. @@ -27,7 +27,7 @@ interface PermissionCriterionResolver * @param string $function * @param array|null $targets * - * @return bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion + * @return bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ public function getPermissionsCriterion(string $module = 'content', string $function = 'read', ?array $targets = null); @@ -38,5 +38,5 @@ public function getPermissionsCriterion(string $module = 'content', string $func * and {@see \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone} are returned * for a user with full and no access respectively. */ - public function getQueryPermissionsCriterion(): Criterion; + public function getQueryPermissionsCriterion(): CriterionInterface; } diff --git a/src/contracts/Repository/SearchService.php b/src/contracts/Repository/SearchService.php index 10d1d63e12..6b4b501f92 100644 --- a/src/contracts/Repository/SearchService.php +++ b/src/contracts/Repository/SearchService.php @@ -11,7 +11,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; /** @@ -166,17 +166,14 @@ public function findContentInfo(Query $query, array $languageFilter = [], bool $ * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - public function findSingle(Criterion $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content; + public function findSingle(CriterionInterface $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content; /** * Suggests a list of values for the given prefix. * - * @param string $prefix * @param string[] $fieldPaths - * @param int $limit - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $filter */ - public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, Criterion $filter = null); + public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, CriterionInterface $filter = null); /** * Finds Locations for the given query. diff --git a/src/contracts/Repository/SectionService.php b/src/contracts/Repository/SectionService.php index 324f9e5866..620a7db755 100644 --- a/src/contracts/Repository/SectionService.php +++ b/src/contracts/Repository/SectionService.php @@ -77,12 +77,6 @@ public function loadSectionByIdentifier(string $sectionIdentifier): Section; /** * Counts the contents which $section is assigned to. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section - * - * @return int - * - * @deprecated since 6.0 */ public function countAssignedContents(Section $section): int; diff --git a/src/contracts/Repository/Values/Content/Location.php b/src/contracts/Repository/Values/Content/Location.php index 3d8557ba13..404a3b4f68 100644 --- a/src/contracts/Repository/Values/Content/Location.php +++ b/src/contracts/Repository/Values/Content/Location.php @@ -43,11 +43,6 @@ abstract class Location extends ValueObject public const SORT_FIELD_PRIORITY = 8; public const SORT_FIELD_NAME = 9; - /** - * @deprecated - */ - public const SORT_FIELD_MODIFIED_SUBNODE = 10; - public const SORT_FIELD_NODE_ID = 11; public const SORT_FIELD_CONTENTOBJECT_ID = 12; @@ -69,11 +64,8 @@ abstract class Location extends ValueObject self::SORT_FIELD_MODIFIED => SortClause\DateModified::class, self::SORT_FIELD_SECTION => SortClause\SectionIdentifier::class, self::SORT_FIELD_DEPTH => SortClause\Location\Depth::class, - //self::SORT_FIELD_CLASS_IDENTIFIER => false, - //self::SORT_FIELD_CLASS_NAME => false, self::SORT_FIELD_PRIORITY => SortClause\Location\Priority::class, self::SORT_FIELD_NAME => SortClause\ContentName::class, - //self::SORT_FIELD_MODIFIED_SUBNODE => false, self::SORT_FIELD_NODE_ID => SortClause\Location\Id::class, self::SORT_FIELD_CONTENTOBJECT_ID => SortClause\ContentId::class, ]; diff --git a/src/contracts/Repository/Values/Content/Query.php b/src/contracts/Repository/Values/Content/Query.php index e0f5c4459c..689d5baee3 100644 --- a/src/contracts/Repository/Values/Content/Query.php +++ b/src/contracts/Repository/Values/Content/Query.php @@ -8,6 +8,7 @@ namespace Ibexa\Contracts\Core\Repository\Values\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -32,10 +33,8 @@ class Query extends ValueObject * * Can contain multiple criterion, as items of a logical one (by default * AND) - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ - public $filter; + public ?CriterionInterface $filter = null; /** * The Query query. @@ -45,10 +44,8 @@ class Query extends ValueObject * * Can contain multiple criterion, as items of a logical one (by default * AND). Defaults to MatchAll. - * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ - public $query; + public ?CriterionInterface $query = null; /** * Query sorting clauses. diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/CompositeCriterion.php b/src/contracts/Repository/Values/Content/Query/Criterion/CompositeCriterion.php index 960347d893..0bc50086b1 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/CompositeCriterion.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/CompositeCriterion.php @@ -10,13 +10,13 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; abstract class CompositeCriterion extends Criterion { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ - public $criteria; + public CriterionInterface $criteria; - public function __construct(Criterion $criteria) + public function __construct(CriterionInterface $criteria) { $this->criteria = $criteria; } diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php b/src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php index 2f5ccd5547..bb11aa828b 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/Location/IsMainLocation.php @@ -55,14 +55,4 @@ public function getSpecifications(): array ), ]; } - - /** - * @deprecated since 7.2, will be removed in 8.0. Use the constructor directly instead. - */ - public static function createFromQueryBuilder($target, $operator, $value) - { - @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); - - return new self($value); - } } diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php b/src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php index 4225edc583..1e42fe1784 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/Location/Priority.php @@ -44,14 +44,4 @@ public function getSpecifications(): array new Specifications(Operator::LTE, Specifications::FORMAT_SINGLE, Specifications::TYPE_INTEGER), ]; } - - /** - * @deprecated since 7.2, will be removed in 8.0. Use the constructor directly instead. - */ - public static function createFromQueryBuilder($target, $operator, $value) - { - @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); - - return new self($operator, $value); - } } diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php b/src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php index 9d89ee8dbd..7f55fb4cda 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/LogicalNot.php @@ -8,7 +8,7 @@ namespace Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion; use Ibexa\Contracts\Core\Repository\Values\Trash\Query\Criterion as TrashCriterion; @@ -22,11 +22,9 @@ class LogicalNot extends LogicalOperator implements FilteringCriterion, TrashCri * * Will match of the given criterion doesn't match * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion[] $criteria One criterion, as an array - * * @throws \InvalidArgumentException if more than one criterion is given in the array parameter */ - public function __construct(Criterion $criterion) + public function __construct(CriterionInterface $criterion) { parent::__construct([$criterion]); } diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/LogicalOperator.php b/src/contracts/Repository/Values/Content/Query/Criterion/LogicalOperator.php index c760a7ead7..fb5918f482 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/LogicalOperator.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/LogicalOperator.php @@ -9,50 +9,36 @@ namespace Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; -use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * Note that the class should ideally have been in a Logical namespace, but it would have then be named 'And', * and 'And' is a PHP reserved word. */ -abstract class LogicalOperator extends Criterion +abstract class LogicalOperator implements CriterionInterface { /** * The set of criteria combined by the logical operator. * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion[] + * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface[] */ public $criteria = []; /** * Creates a Logic operation with the given criteria. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion[] $criteria + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface[] $criteria * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException */ public function __construct(array $criteria) { foreach ($criteria as $key => $criterion) { - if (!$criterion instanceof Criterion) { - throw new InvalidCriterionArgumentException($key, $criterion, Criterion::class); + if (!$criterion instanceof CriterionInterface) { + throw new InvalidCriterionArgumentException($key, $criterion, CriterionInterface::class); } $this->criteria[] = $criterion; } } - - /** - * @return array - * - * @deprecated in LogicalOperators since 7.2. - * It will be removed in 8.0 when Logical Operator no longer extends Criterion. - */ - public function getSpecifications(): array - { - @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); - - throw new NotImplementedException('getSpecifications() not implemented for LogicalOperators'); - } } diff --git a/src/contracts/Repository/Values/Content/URLWildcard/Query/Criterion.php b/src/contracts/Repository/Values/Content/URLWildcard/Query/Criterion.php index 4ba1d37427..db658ce57b 100644 --- a/src/contracts/Repository/Values/Content/URLWildcard/Query/Criterion.php +++ b/src/contracts/Repository/Values/Content/URLWildcard/Query/Criterion.php @@ -8,6 +8,8 @@ namespace Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\Query; -interface Criterion +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; + +interface Criterion extends CriterionInterface { } diff --git a/src/contracts/Repository/Values/Filter/FilteringCriterion.php b/src/contracts/Repository/Values/Filter/FilteringCriterion.php index 81613180cf..4842705d80 100644 --- a/src/contracts/Repository/Values/Filter/FilteringCriterion.php +++ b/src/contracts/Repository/Values/Filter/FilteringCriterion.php @@ -8,9 +8,11 @@ namespace Ibexa\Contracts\Core\Repository\Values\Filter; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; + /** * Marker for Content & Location filtering Criterion. */ -interface FilteringCriterion +interface FilteringCriterion extends CriterionInterface { } diff --git a/src/contracts/Repository/Values/Trash/Query/Criterion.php b/src/contracts/Repository/Values/Trash/Query/Criterion.php index 0eef9858ce..2591cf4db1 100644 --- a/src/contracts/Repository/Values/Trash/Query/Criterion.php +++ b/src/contracts/Repository/Values/Trash/Query/Criterion.php @@ -8,9 +8,11 @@ namespace Ibexa\Contracts\Core\Repository\Values\Trash\Query; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; + /** * Marker for Content & Location trash Criterion. */ -interface Criterion +interface Criterion extends CriterionInterface { } diff --git a/src/contracts/Search/Handler.php b/src/contracts/Search/Handler.php index d15eec6540..dc3c184a44 100644 --- a/src/contracts/Search/Handler.php +++ b/src/contracts/Search/Handler.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * The Search handler retrieves sets of of Content objects, based on a @@ -37,19 +38,19 @@ public function findContent(Query $query, array $languageFilter = []); /** * Performs a query for a single content object. * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if Criterion is not applicable to its target - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if there is more than than one result matching the criterions - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $filter + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface $filter * @param array $languageFilter a map of language related filters specifying languages query will be performed on. * Also used to define which field languages are loaded for the returned content. * Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) * useAlwaysAvailable defaults to true to avoid exceptions on missing translations * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo + * + *@throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if Criterion is not applicable to its target + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if there is more than than one result matching the criterions */ - public function findSingle(Criterion $filter, array $languageFilter = []); + public function findSingle(CriterionInterface $filter, array $languageFilter = []); /** * Finds locations for the given $query. diff --git a/src/contracts/User/Identity.php b/src/contracts/User/Identity.php deleted file mode 100644 index fe71bb1dbd..0000000000 --- a/src/contracts/User/Identity.php +++ /dev/null @@ -1,56 +0,0 @@ -repositoryConfigurationProvider->getRepositoryConfig(); @@ -101,7 +101,6 @@ public function buildRepository( $relationProcessor, $fieldTypeRegistry, $passwordHashService, - $thumbnailStrategy, $proxyDomainMapperFactory, $contentDomainMapper, $contentTypeDomainMapper, @@ -116,6 +115,7 @@ public function buildRepository( $passwordValidator, $configResolver, $nameSchemaService, + $transactionHandler, [ 'role' => [ 'policyMap' => $this->policyMap, diff --git a/src/lib/Event/ContentService.php b/src/lib/Event/ContentService.php index 37378c2b13..e9f4fb9a67 100644 --- a/src/lib/Event/ContentService.php +++ b/src/lib/Event/ContentService.php @@ -134,7 +134,7 @@ public function deleteContent(ContentInfo $contentInfo): iterable : $this->innerService->deleteContent($contentInfo); $this->eventDispatcher->dispatch( - new DeleteContentEvent($locations, ...$eventData) + new DeleteContentEvent(iterator_to_array($locations), ...$eventData) ); return $locations; diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index a7993a6d30..b3513a0604 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -371,7 +371,6 @@ public function toHash(SPIValue $value) return [ 'id' => $value->id, - 'path' => $value->inputUri ?: $value->id, 'alternativeText' => $value->alternativeText, 'fileName' => $value->fileName, 'fileSize' => $value->fileSize, diff --git a/src/lib/FieldType/Image/Value.php b/src/lib/FieldType/Image/Value.php index e92c18b62c..369c8ec036 100644 --- a/src/lib/FieldType/Image/Value.php +++ b/src/lib/FieldType/Image/Value.php @@ -11,15 +11,6 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\FieldType\Value as BaseValue; -/** - * Value for Image field type. - * - * @property string $path @deprecated BC with 5.0 (EZP-20948). Equivalent to $id or $inputUri, depending on which one is set - * . - * - * @todo Mime type? - * @todo Dimensions? - */ class Value extends BaseValue { /** @@ -122,15 +113,9 @@ public function isAlternativeTextEmpty(): bool /** * Creates a value only from a file path. * - * @param string $path - * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType - * - * @return Value - * - * @deprecated Starting with 5.3.3, handled by Image\Type::acceptValue() */ - public static function fromString($path) + public static function fromString(string $path): self { if (!file_exists($path)) { throw new InvalidArgumentType( @@ -163,24 +148,4 @@ public function __toString() { return (string)$this->fileName; } - - public function __get($propertyName) - { - if ($propertyName === 'path') { - return $this->inputUri ?: $this->id; - } - - throw new PropertyNotFoundException($propertyName, static::class); - } - - public function __set($propertyName, $propertyValue) - { - if ($propertyName === 'path') { - $this->inputUri = $propertyValue; - - return; - } - - throw new PropertyNotFoundException($propertyName, static::class); - } } diff --git a/src/lib/FieldType/StorageGateway.php b/src/lib/FieldType/StorageGateway.php deleted file mode 100644 index fbb1aee40f..0000000000 --- a/src/lib/FieldType/StorageGateway.php +++ /dev/null @@ -1,31 +0,0 @@ -fieldTypeService = $fieldTypeService; - $this->contentTypeService = $contentTypeService; $this->translationHelper = $translationHelper; } @@ -49,22 +43,4 @@ public function isFieldEmpty(Content $content, $fieldDefIdentifier, $forcedLangu ->getFieldType($fieldDefinition->fieldTypeIdentifier) ->isEmptyValue($field->value); } - - /** - * Returns FieldDefinition object based on $contentInfo and $fieldDefIdentifier. - * - * @deprecated If you have Content you can instead do: $content->getContentType()->getFieldDefinition($identifier) - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param string $fieldDefIdentifier - * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition - */ - public function getFieldDefinition(ContentInfo $contentInfo, $fieldDefIdentifier) - { - return $this - ->contentTypeService - ->loadContentType($contentInfo->contentTypeId) - ->getFieldDefinition($fieldDefIdentifier); - } } diff --git a/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php b/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php index 9054d74cdf..8217406ded 100644 --- a/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php @@ -42,7 +42,7 @@ public function getViewParameters(Field $field) // Start by setting missing ids as false on $available $available = array_fill_keys( - array_diff($ids, array_keys($list)), + array_diff($ids, array_keys(iterator_to_array($list))), false ); diff --git a/src/lib/Persistence/Cache/ContentHandler.php b/src/lib/Persistence/Cache/ContentHandler.php index 84433773b1..bd0ffb3de3 100644 --- a/src/lib/Persistence/Cache/ContentHandler.php +++ b/src/lib/Persistence/Cache/ContentHandler.php @@ -509,23 +509,6 @@ public function loadRelation(int $relationId): Relation return $relation; } - /** - * {@inheritdoc} - */ - public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null) - { - $this->logger->logCall( - __METHOD__, - [ - 'content' => $sourceContentId, - 'version' => $sourceContentVersionNo, - 'type' => $type, - ] - ); - - return $this->persistenceHandler->contentHandler()->loadRelations($sourceContentId, $sourceContentVersionNo, $type); - } - public function countRelations(int $sourceContentId, ?int $sourceContentVersionNo = null, ?int $type = null): int { $cacheItem = $this->cache->getItem( diff --git a/src/lib/Persistence/Cache/Handler.php b/src/lib/Persistence/Cache/Handler.php index 51bbc3e73b..36b225a107 100644 --- a/src/lib/Persistence/Cache/Handler.php +++ b/src/lib/Persistence/Cache/Handler.php @@ -250,28 +250,4 @@ public function userPreferenceHandler() { return $this->userPreferenceHandler; } - - /** - * {@inheritdoc} - */ - public function beginTransaction() - { - $this->transactionHandler->beginTransaction(); - } - - /** - * {@inheritdoc} - */ - public function commit() - { - $this->transactionHandler->commit(); - } - - /** - * {@inheritdoc} - */ - public function rollback() - { - $this->transactionHandler->rollback(); - } } diff --git a/src/lib/Persistence/Cache/LocationHandler.php b/src/lib/Persistence/Cache/LocationHandler.php index 78a4be91db..c049e15aa2 100644 --- a/src/lib/Persistence/Cache/LocationHandler.php +++ b/src/lib/Persistence/Cache/LocationHandler.php @@ -281,15 +281,6 @@ public function move($sourceId, $destinationParentId) return $return; } - /** - * {@inheritdoc} - */ - public function markSubtreeModified($locationId, $timestamp = null) - { - $this->logger->logCall(__METHOD__, ['location' => $locationId, 'time' => $timestamp]); - $this->persistenceHandler->locationHandler()->markSubtreeModified($locationId, $timestamp); - } - /** * {@inheritdoc} */ diff --git a/src/lib/Persistence/Cache/PersistenceLogger.php b/src/lib/Persistence/Cache/PersistenceLogger.php index f4392b4e44..88e427a153 100644 --- a/src/lib/Persistence/Cache/PersistenceLogger.php +++ b/src/lib/Persistence/Cache/PersistenceLogger.php @@ -215,16 +215,6 @@ public function getName(): string return self::NAME; } - /** - * Counts the total of spi uncached call (cache miss and uncached calls). - * - * @deprecated Since 7.5, use getStats(). - */ - public function getCount(): int - { - return $this->stats['uncached'] + $this->stats['miss']; - } - /** * Get stats (call/miss/hit/memory). * diff --git a/src/lib/Persistence/Cache/TrashHandler.php b/src/lib/Persistence/Cache/TrashHandler.php index 1c1213b5ea..f9a870ef0d 100644 --- a/src/lib/Persistence/Cache/TrashHandler.php +++ b/src/lib/Persistence/Cache/TrashHandler.php @@ -9,7 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Location\Trash\Handler as TrashHandlerInterface; use Ibexa\Contracts\Core\Persistence\Content\Relation; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; class TrashHandler extends AbstractHandler implements TrashHandlerInterface { @@ -35,8 +35,14 @@ public function trashSubtree($locationId) $this->logger->logCall(__METHOD__, ['locationId' => $locationId]); $location = $this->persistenceHandler->locationHandler()->load($locationId); - $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelations($location->contentId); + $limit = $this->persistenceHandler->contentHandler()->countRelations( + $location->contentId + ); + $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelationList( + $location->contentId, + $limit + ); $return = $this->persistenceHandler->trashHandler()->trashSubtree($locationId); $relationTags = []; @@ -71,7 +77,15 @@ public function recover($trashedId, $newParentId) $return = $this->persistenceHandler->trashHandler()->recover($trashedId, $newParentId); $location = $this->persistenceHandler->locationHandler()->load($return); - $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelations($location->contentId); + + $limit = $this->persistenceHandler->contentHandler()->countRelations( + $location->contentId + ); + + $reverseRelations = $this->persistenceHandler->contentHandler()->loadRelationList( + $location->contentId, + $limit + ); $relationTags = []; if (!empty($reverseRelations)) { @@ -95,7 +109,7 @@ public function recover($trashedId, $newParentId) /** * {@inheritdoc} */ - public function findTrashItems(Criterion $criterion = null, $offset = 0, $limit = null, array $sort = null) + public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null) { $this->logger->logCall(__METHOD__, ['criterion' => $criterion ? get_class($criterion) : 'null']); diff --git a/src/lib/Persistence/Cache/UserHandler.php b/src/lib/Persistence/Cache/UserHandler.php index 12fcd4d50d..744fc53cf5 100644 --- a/src/lib/Persistence/Cache/UserHandler.php +++ b/src/lib/Persistence/Cache/UserHandler.php @@ -688,16 +688,6 @@ public function deletePolicy($policyId, $roleId) ]); } - /** - * {@inheritdoc} - */ - public function loadPoliciesByUserId($userId) - { - $this->logger->logCall(__METHOD__, ['user' => $userId]); - - return $this->persistenceHandler->userHandler()->loadPoliciesByUserId($userId); - } - /** * {@inheritdoc} */ diff --git a/src/lib/Persistence/FieldType.php b/src/lib/Persistence/FieldType.php index f7f0f45913..c71152ebe2 100644 --- a/src/lib/Persistence/FieldType.php +++ b/src/lib/Persistence/FieldType.php @@ -16,7 +16,7 @@ * * @see \Ibexa\Contracts\Core\FieldType\FieldType */ -class FieldType implements FieldTypeInterface, FieldTypeInterface\IsEmptyValue +class FieldType implements FieldTypeInterface { /** * Holds internal FieldType object. diff --git a/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php index 14455a7547..3a85904f3b 100644 --- a/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php @@ -41,11 +41,9 @@ public function insertBookmark(Bookmark $bookmark): int $query ->insert(self::TABLE_BOOKMARKS) ->values([ - self::COLUMN_NAME => ':name', self::COLUMN_USER_ID => ':user_id', self::COLUMN_LOCATION_ID => ':location_id', ]) - ->setParameter(':name', $bookmark->name, PDO::PARAM_STR) ->setParameter(':user_id', $bookmark->userId, PDO::PARAM_INT) ->setParameter(':location_id', $bookmark->locationId, PDO::PARAM_INT); diff --git a/src/lib/Persistence/Legacy/Bookmark/Mapper.php b/src/lib/Persistence/Legacy/Bookmark/Mapper.php index 11f547b1d8..985b638418 100644 --- a/src/lib/Persistence/Legacy/Bookmark/Mapper.php +++ b/src/lib/Persistence/Legacy/Bookmark/Mapper.php @@ -26,7 +26,6 @@ class Mapper public function createBookmarkFromCreateStruct(CreateStruct $createStruct): Bookmark { $bookmark = new Bookmark(); - $bookmark->name = $createStruct->name; $bookmark->locationId = $createStruct->locationId; $bookmark->userId = $createStruct->userId; @@ -61,7 +60,6 @@ private function extractBookmarkFromRow(array $row): Bookmark { $bookmark = new Bookmark(); $bookmark->id = (int)$row['id']; - $bookmark->name = $row['name']; $bookmark->userId = (int)$row['user_id']; $bookmark->locationId = (int)$row['node_id']; diff --git a/src/lib/Persistence/Legacy/Content/Handler.php b/src/lib/Persistence/Legacy/Content/Handler.php index 6672a4fbcc..d0226afa13 100644 --- a/src/lib/Persistence/Legacy/Content/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Handler.php @@ -825,25 +825,6 @@ public function removeRelation($relationId, $type, ?int $destinationContentId = $this->contentGateway->deleteRelation($relationId, $type); } - /** - * Loads relations from $sourceContentId. Optionally, loads only those with $type and $sourceContentVersionNo. - * - * @param mixed $sourceContentId Source Content ID - * @param mixed|null $sourceContentVersionNo Source Content Version, null if not specified - * @param int|null $type {@see \Ibexa\Contracts\Core\Repository\Values\Content\Relation::COMMON, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::EMBED, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::LINK, - * \Ibexa\Contracts\Core\Repository\Values\Content\Relation::FIELD} - * - * @return \Ibexa\Contracts\Core\Persistence\Content\Relation[] - */ - public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null) - { - return $this->mapper->extractRelationsFromRows( - $this->contentGateway->loadRelations($sourceContentId, $sourceContentVersionNo, $type) - ); - } - public function countRelations(int $sourceContentId, ?int $sourceContentVersionNo = null, ?int $type = null): int { return $this->contentGateway->countRelations($sourceContentId, $sourceContentVersionNo, $type); diff --git a/src/lib/Persistence/Legacy/Content/Location/Gateway.php b/src/lib/Persistence/Legacy/Content/Location/Gateway.php index 84a4e021d1..59365b76ab 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Gateway.php +++ b/src/lib/Persistence/Legacy/Content/Location/Gateway.php @@ -10,7 +10,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Location\UpdateStruct; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * Base class for location gateways. @@ -139,16 +139,6 @@ abstract public function getChildren(int $locationId): array; */ abstract public function moveSubtreeNodes(array $fromPathString, array $toPathString): void; - /** - * Updated subtree modification time for all nodes on path. - * - * @deprecated Not supposed to be in use anymore. - */ - abstract public function updateSubtreeModificationTime( - string $pathString, - ?int $timestamp = null - ): void; - /** * Update node assignment table. */ @@ -306,7 +296,7 @@ abstract public function cleanupTrash(): void; * @param int $offset * @param int|null $limit * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $sort - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null $criterion + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface|null $criterion * * @return array entries from ezcontentobject_trash. */ @@ -314,13 +304,13 @@ abstract public function listTrashed( int $offset, ?int $limit, array $sort = null, - ?Criterion $criterion = null + ?CriterionInterface $criterion = null ): array; /** * Count trashed items. */ - abstract public function countTrashed(?Criterion $criterion = null): int; + abstract public function countTrashed(?CriterionInterface $criterion = null): int; /** * Removes trashed element identified by $id from trash. diff --git a/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php index 592c4488d1..67b84f7c06 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php @@ -16,7 +16,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Location\UpdateStruct; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\NotFoundException as NotFound; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; @@ -493,28 +493,6 @@ private function moveSingleSubtreeNode( $query->execute(); } - public function updateSubtreeModificationTime(string $pathString, ?int $timestamp = null): void - { - $nodes = array_filter(explode('/', $pathString)); - $query = $this->connection->createQueryBuilder(); - $query - ->update(self::CONTENT_TREE_TABLE) - ->set( - 'modified_subnode', - $query->createPositionalParameter( - $timestamp ?: time(), - ParameterType::INTEGER - ) - ) - ->where( - $query->expr()->in( - 'node_id', - $nodes - ) - ); - $query->execute(); - } - public function hideSubtree(string $pathString): void { $this->setNodeWithChildrenInvisible($pathString); @@ -1260,7 +1238,7 @@ public function listTrashed( int $offset, ?int $limit, array $sort = null, - ?Criterion $criterion = null + ?CriterionInterface $criterion = null ): array { $query = $this->connection->createQueryBuilder(); $query @@ -1281,7 +1259,7 @@ public function listTrashed( return $statement->fetchAll(FetchMode::ASSOCIATIVE); } - public function countTrashed(?Criterion $criterion = null): int + public function countTrashed(?CriterionInterface $criterion = null): int { $query = $this->connection->createQueryBuilder() ->select($this->dbPlatform->getCountExpression(1)) @@ -1616,7 +1594,7 @@ private function insertLocationIntoContentTree( /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - private function addConditionsByCriterion(?Criterion $criterion, QueryBuilder $query): void + private function addConditionsByCriterion(?CriterionInterface $criterion, QueryBuilder $query): void { if (null === $criterion) { return; diff --git a/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php index 3eb53f2f5e..22841f85a9 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php @@ -11,7 +11,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Location\UpdateStruct; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\DatabaseException; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway; use PDOException; @@ -146,15 +146,6 @@ public function moveSubtreeNodes(array $fromPathString, array $toPathString): vo } } - public function updateSubtreeModificationTime(string $pathString, ?int $timestamp = null): void - { - try { - $this->innerGateway->updateSubtreeModificationTime($pathString, $timestamp); - } catch (DBALException | PDOException $e) { - throw DatabaseException::wrap($e); - } - } - public function updateNodeAssignment( int $contentObjectId, int $oldParent, @@ -358,7 +349,7 @@ public function listTrashed( int $offset, ?int $limit, array $sort = null, - ?Criterion $criterion = null + ?CriterionInterface $criterion = null ): array { try { return $this->innerGateway->listTrashed($offset, $limit, $sort, $criterion); @@ -367,7 +358,7 @@ public function listTrashed( } } - public function countTrashed(?Criterion $criterion = null): int + public function countTrashed(?CriterionInterface $criterion = null): int { try { return $this->innerGateway->countTrashed($criterion); diff --git a/src/lib/Persistence/Legacy/Content/Location/Handler.php b/src/lib/Persistence/Legacy/Content/Location/Handler.php index dfcb28fac3..f4a9cd44d9 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Location/Handler.php @@ -278,11 +278,6 @@ public function copySubtree($sourceId, $destinationParentId, $newOwnerId = null) || $createStruct->hidden || $parentData['hidden'] || $parentData['invisible']; - $pathString = explode('/', $child['path_identification_string']); - $pathString = end($pathString); - $createStruct->pathIdentificationString = strlen($pathString) > 0 - ? $parentData['path_identification_string'] . '/' . $pathString - : null; // Use content main location if already set, otherwise create location as main if (isset($mainLocations[$child['contentobject_id']])) { @@ -307,7 +302,6 @@ public function copySubtree($sourceId, $destinationParentId, $newOwnerId = null) 'id' => $newLocation->id, 'hidden' => $newLocation->hidden, 'invisible' => $newLocation->invisible, - 'path_identification_string' => $newLocation->pathIdentificationString, ]; if ($index === 0) { $copiedSubtreeRootLocation = $newLocation; @@ -424,22 +418,6 @@ public function move($sourceId, $destinationParentId) } } - /** - * Marks the given nodes and all ancestors as modified. - * - * Optionally a time stamp with the modification date may be specified, - * otherwise the current time is used. - * - * @param int|string $locationId - * @param int $timestamp - */ - public function markSubtreeModified($locationId, $timestamp = null) - { - $nodeData = $this->locationGateway->getBasicNodeData($locationId); - $timestamp = $timestamp ?: time(); - $this->locationGateway->updateSubtreeModificationTime($nodeData['path_string'], $timestamp); - } - /** * Sets a location to be hidden, and it self + all children to invisible. * diff --git a/src/lib/Persistence/Legacy/Content/Location/Mapper.php b/src/lib/Persistence/Legacy/Content/Location/Mapper.php index 949eee2aa6..72730eba74 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Location/Mapper.php @@ -39,7 +39,6 @@ public function createLocationFromRow(array $data, $prefix = '', ?Location $loca $location->remoteId = $data[$prefix . 'remote_id']; $location->contentId = (int)$data[$prefix . 'contentobject_id']; $location->parentId = (int)$data[$prefix . 'parent_node_id']; - $location->pathIdentificationString = $data[$prefix . 'path_identification_string']; $location->pathString = $data[$prefix . 'path_string']; $location->depth = (int)$data[$prefix . 'depth']; $location->sortField = (int)$data[$prefix . 'sort_field']; @@ -92,7 +91,6 @@ public function getLocationCreateStruct(array $data) $struct->invisible = $data['is_invisible']; $struct->mainLocationId = $data['main_node_id']; $struct->parentId = $data['parent_node_id']; - $struct->pathIdentificationString = $data['path_identification_string']; $struct->priority = $data['priority']; $struct->remoteId = md5(uniqid(static::class, true)); $struct->sortField = $data['sort_field']; diff --git a/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php b/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php index ea5750ed1b..1fd15e816c 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php @@ -10,7 +10,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Location\Trash\Handler as BaseTrashHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Trash\TrashResult; use Ibexa\Contracts\Core\Persistence\Content\Location\Trashed; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResult; use Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResultList; use Ibexa\Core\Persistence\Legacy\Content\Handler as ContentHandler; @@ -99,14 +99,9 @@ public function trashSubtree($locationId) { $locationRows = $this->locationGateway->getSubtreeContent($locationId); $isLocationRemoved = false; - $parentLocationId = null; $removedLocationsContentMap = []; foreach ($locationRows as $locationRow) { - if ($locationRow['node_id'] == $locationId) { - $parentLocationId = $locationRow['parent_node_id']; - } - if ($this->locationGateway->countLocationsByContentId($locationRow['contentobject_id']) == 1) { $this->locationGateway->trashLocation($locationRow['node_id']); $removedLocationsContentMap[(int)$locationRow['node_id']] = (int)$locationRow['contentobject_id']; @@ -124,18 +119,12 @@ public function trashSubtree($locationId) $this->locationHandler->changeMainLocation( $locationRow['contentobject_id'], - $newMainLocationRow['node_id'], - $newMainLocationRow['contentobject_version'], - $newMainLocationRow['parent_node_id'] + $newMainLocationRow['node_id'] ); } } } - if (isset($parentLocationId)) { - $this->locationHandler->markSubtreeModified($parentLocationId, time()); - } - if ($isLocationRemoved === true) { return null; } @@ -172,7 +161,7 @@ public function recover($trashedId, $newParentId) /** * {@inheritdoc}. */ - public function findTrashItems(Criterion $criterion = null, $offset = 0, $limit = null, array $sort = null) + public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null) { $totalCount = $this->locationGateway->countTrashed($criterion); if ($totalCount === 0) { diff --git a/src/lib/Persistence/Legacy/Content/Mapper.php b/src/lib/Persistence/Legacy/Content/Mapper.php index fa3cc55ac7..0eae8b2784 100644 --- a/src/lib/Persistence/Legacy/Content/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Mapper.php @@ -107,7 +107,6 @@ private function createContentInfoFromCreateStruct(CreateStruct $struct, $curren $contentInfo->modificationDate = 0; $contentInfo->currentVersionNo = $currentVersionNo; $contentInfo->status = ContentInfo::STATUS_DRAFT; - $contentInfo->isPublished = false; $contentInfo->isHidden = $struct->isHidden; return $contentInfo; @@ -396,7 +395,6 @@ public function extractContentInfoFromRow(array $row, $prefix = '', $treePrefix $contentInfo->remoteId = (string)$row["{$prefix}remote_id"]; $contentInfo->mainLocationId = ($row["{$treePrefix}main_node_id"] !== null ? (int)$row["{$treePrefix}main_node_id"] : null); $contentInfo->status = (int)$row["{$prefix}status"]; - $contentInfo->isPublished = ($contentInfo->status == ContentInfo::STATUS_PUBLISHED); $contentInfo->isHidden = (bool)$row["{$prefix}is_hidden"]; return $contentInfo; diff --git a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php index e035a7069f..ae22b35955 100644 --- a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php +++ b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php @@ -197,9 +197,6 @@ public function mapContentMetadataToPersistenceContentInfo(array $row): ContentI $contentInfo->status = (int)$row['content_status']; $contentInfo->isHidden = (bool)$row['content_is_hidden']; - // setting deprecated property for BC reasons - $contentInfo->isPublished = $contentInfo->status === ContentInfo::STATUS_PUBLISHED; - return $contentInfo; } } diff --git a/src/lib/Persistence/Legacy/Handler.php b/src/lib/Persistence/Legacy/Handler.php index c9e38b3961..93d740638d 100644 --- a/src/lib/Persistence/Legacy/Handler.php +++ b/src/lib/Persistence/Legacy/Handler.php @@ -203,42 +203,4 @@ public function transactionHandler() { return $this->transactionHandler; } - - /** - * Begin transaction. - * - * @deprecated Since 5.3 {@use transactionHandler()->beginTransaction()} - */ - public function beginTransaction() - { - $this->transactionHandler->beginTransaction(); - } - - /** - * Commit transaction. - * - * Commit transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - * - * @deprecated Since 5.3 {@use transactionHandler()->beginTransaction()} - */ - public function commit() - { - $this->transactionHandler->commit(); - } - - /** - * Rollback transaction. - * - * Rollback transaction, or throw exceptions if no transactions has been started. - * - * @throws \RuntimeException If no transaction has been started - * - * @deprecated Since 5.3 {@use transactionHandler()->beginTransaction()} - */ - public function rollback() - { - $this->transactionHandler->rollback(); - } } diff --git a/src/lib/Persistence/Legacy/User/Handler.php b/src/lib/Persistence/Legacy/User/Handler.php index 59913f2437..d4d809571f 100644 --- a/src/lib/Persistence/Legacy/User/Handler.php +++ b/src/lib/Persistence/Legacy/User/Handler.php @@ -542,26 +542,6 @@ public function deletePolicy($policyId, $roleId) $this->roleGateway->removePolicy($policyId); } - /** - * Returns the user policies associated with the user (including inherited policies from user groups). - * - * @param mixed $userId - * - * @return \Ibexa\Contracts\Core\Persistence\User\Policy[] - */ - public function loadPoliciesByUserId($userId) - { - $data = $this->roleGateway->loadPoliciesByUserId($userId); - - $policies = $this->mapper->mapPolicies($data); - - foreach ($policies as $policy) { - $this->limitationConverter->toSPI($policy); - } - - return $policies; - } - /** * Assigns role to a user or user group with given limitations. * diff --git a/src/lib/QueryType/BuiltIn/AbstractQueryType.php b/src/lib/QueryType/BuiltIn/AbstractQueryType.php index ed0a9bb27e..28cf18b62d 100644 --- a/src/lib/QueryType/BuiltIn/AbstractQueryType.php +++ b/src/lib/QueryType/BuiltIn/AbstractQueryType.php @@ -10,11 +10,11 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Subtree; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Visibility; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\QueryType\OptionsResolverBasedQueryType; @@ -80,7 +80,7 @@ protected function configureOptions(OptionsResolver $resolver): void $resolver->setAllowedTypes('limit', 'int'); } - abstract protected function getQueryFilter(array $parameters): Criterion; + abstract protected function getQueryFilter(array $parameters): CriterionInterface; protected function createQuery(): Query { @@ -102,7 +102,7 @@ protected function doGetQuery(array $parameters): Query return $query; } - private function buildFilters(array $parameters): Criterion + private function buildFilters(array $parameters): CriterionInterface { $criteria = [ $this->getQueryFilter($parameters), diff --git a/src/lib/QueryType/BuiltIn/AncestorsQueryType.php b/src/lib/QueryType/BuiltIn/AncestorsQueryType.php index 6c4e8e96fa..032c06eec2 100644 --- a/src/lib/QueryType/BuiltIn/AncestorsQueryType.php +++ b/src/lib/QueryType/BuiltIn/AncestorsQueryType.php @@ -8,12 +8,12 @@ namespace Ibexa\Core\QueryType\BuiltIn; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationId; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalNot; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; final class AncestorsQueryType extends AbstractLocationQueryType { @@ -22,7 +22,7 @@ public static function getName(): string return 'Ancestors'; } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { $location = $this->resolveLocation($parameters); diff --git a/src/lib/QueryType/BuiltIn/ChildrenQueryType.php b/src/lib/QueryType/BuiltIn/ChildrenQueryType.php index ecf66c3650..cd38a5bd16 100644 --- a/src/lib/QueryType/BuiltIn/ChildrenQueryType.php +++ b/src/lib/QueryType/BuiltIn/ChildrenQueryType.php @@ -8,9 +8,9 @@ namespace Ibexa\Core\QueryType\BuiltIn; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; final class ChildrenQueryType extends AbstractLocationQueryType { @@ -19,7 +19,7 @@ public static function getName(): string return 'Children'; } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { $location = $this->resolveLocation($parameters); diff --git a/src/lib/QueryType/BuiltIn/GeoLocationQueryType.php b/src/lib/QueryType/BuiltIn/GeoLocationQueryType.php index c415f05d90..796f234819 100644 --- a/src/lib/QueryType/BuiltIn/GeoLocationQueryType.php +++ b/src/lib/QueryType/BuiltIn/GeoLocationQueryType.php @@ -9,9 +9,9 @@ namespace Ibexa\Core\QueryType\BuiltIn; use Ibexa\Contracts\Core\Repository\Values\Content\Field; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MapLocationDistance; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -58,7 +58,7 @@ protected function configureOptions(OptionsResolver $resolver): void ]); } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { return new MapLocationDistance( $parameters['field'], diff --git a/src/lib/QueryType/BuiltIn/RelatedToContentQueryType.php b/src/lib/QueryType/BuiltIn/RelatedToContentQueryType.php index bb1033d57e..47e481dffa 100644 --- a/src/lib/QueryType/BuiltIn/RelatedToContentQueryType.php +++ b/src/lib/QueryType/BuiltIn/RelatedToContentQueryType.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\FieldRelation; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -48,7 +49,7 @@ protected function configureOptions(OptionsResolver $resolver): void }); } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { return new FieldRelation( $parameters['field'], diff --git a/src/lib/QueryType/BuiltIn/SiblingsQueryType.php b/src/lib/QueryType/BuiltIn/SiblingsQueryType.php index a0655922c8..7512288549 100644 --- a/src/lib/QueryType/BuiltIn/SiblingsQueryType.php +++ b/src/lib/QueryType/BuiltIn/SiblingsQueryType.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; final class SiblingsQueryType extends AbstractLocationQueryType { @@ -18,7 +19,7 @@ public static function getName(): string return 'Siblings'; } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { $location = $this->resolveLocation($parameters); diff --git a/src/lib/QueryType/BuiltIn/SubtreeQueryType.php b/src/lib/QueryType/BuiltIn/SubtreeQueryType.php index dc742112e8..1916a7410b 100644 --- a/src/lib/QueryType/BuiltIn/SubtreeQueryType.php +++ b/src/lib/QueryType/BuiltIn/SubtreeQueryType.php @@ -8,12 +8,12 @@ namespace Ibexa\Core\QueryType\BuiltIn; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Depth; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Subtree; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Symfony\Component\OptionsResolver\OptionsResolver; final class SubtreeQueryType extends AbstractLocationQueryType @@ -33,7 +33,7 @@ protected function configureOptions(OptionsResolver $resolver): void $resolver->setAllowedTypes('depth', 'int'); } - protected function getQueryFilter(array $parameters): Criterion + protected function getQueryFilter(array $parameters): CriterionInterface { $location = $this->resolveLocation($parameters); diff --git a/src/lib/Repository/BookmarkService.php b/src/lib/Repository/BookmarkService.php index acf178cb10..14831759bf 100644 --- a/src/lib/Repository/BookmarkService.php +++ b/src/lib/Repository/BookmarkService.php @@ -50,7 +50,6 @@ public function createBookmark(Location $location): void } $createStruct = new CreateStruct(); - $createStruct->name = $loadedLocation->contentInfo->name; $createStruct->locationId = $loadedLocation->id; $createStruct->userId = $this->getCurrentUserId(); diff --git a/src/lib/Repository/ContentService.php b/src/lib/Repository/ContentService.php index f8ce15a912..07f00188fb 100644 --- a/src/lib/Repository/ContentService.php +++ b/src/lib/Repository/ContentService.php @@ -254,7 +254,7 @@ public function loadContentInfoByRemoteId(string $remoteId): ContentInfo */ public function loadVersionInfo(ContentInfo $contentInfo, ?int $versionNo = null): APIVersionInfo { - return $this->loadVersionInfoById($contentInfo->getId(), $versionNo); + return $this->loadVersionInfoById((int)$contentInfo->getId(), $versionNo); } /** @@ -320,7 +320,7 @@ public function loadVersionInfoListByContentInfo(array $contentInfoList): array $contentIds = array_map( static function (ContentInfo $contentInfo): int { - return $contentInfo->getId(); + return (int)$contentInfo->getId(); }, $contentInfoList ); @@ -333,7 +333,7 @@ static function (ContentInfo $contentInfo): int { foreach ($persistenceVersionInfos as $persistenceVersionInfo) { $versionInfo = $this->contentDomainMapper->buildVersionInfoDomainObject($persistenceVersionInfo); if ($this->permissionResolver->canUser('content', 'read', $versionInfo)) { - $versionInfoList[$versionInfo->getContentInfo()->getId()] = $versionInfo; + $versionInfoList[(int)$versionInfo->getContentInfo()->getId()] = $versionInfo; } } @@ -1481,7 +1481,7 @@ protected function copyNonTranslatableFieldsFromPublishedVersion(APIContent $cur $versionInfo = $currentVersionContent->getVersionInfo(); $contentType = $currentVersionContent->getContentType(); - $publishedContent = $this->internalLoadContentById($versionInfo->getContentInfo()->getId()); + $publishedContent = $this->internalLoadContentById((int)$versionInfo->getContentInfo()->getId()); $publishedVersionInfo = $publishedContent->getVersionInfo(); if (!$publishedVersionInfo->isPublished()) { @@ -1551,7 +1551,7 @@ protected function copyNonTranslatableFieldsFromPublishedVersion(APIContent $cur $updateStruct->fields = $persistenceFields; $this->persistenceHandler->contentHandler()->updateContent( - $versionInfo->getContentInfo()->getId(), + (int)$versionInfo->getContentInfo()->getId(), $versionInfo->versionNo, $updateStruct ); @@ -1971,11 +1971,19 @@ public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $dest protected function internalLoadRelations(APIVersionInfo $versionInfo): array { $contentInfo = $versionInfo->getContentInfo(); - $spiRelations = $this->persistenceHandler->contentHandler()->loadRelations( - $contentInfo->id, + + $limit = $this->persistenceHandler->contentHandler()->countRelations( + (int)$contentInfo->getId(), $versionInfo->versionNo ); + $spiRelations = $this->persistenceHandler->contentHandler()->loadRelationList( + (int)$contentInfo->getId(), + $limit, + 0, + $versionInfo->versionNo, + ); + /** @var $relations \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ $relations = []; foreach ($spiRelations as $spiRelation) { @@ -2082,7 +2090,7 @@ public function countReverseRelations(ContentInfo $contentInfo, ?RelationType $t return 0; } - return $this->persistenceHandler->contentHandler()->countReverseRelations($contentInfo->getId(), $type?->value); + return $this->persistenceHandler->contentHandler()->countReverseRelations((int)$contentInfo->getId(), $type?->value); } /** @@ -2258,19 +2266,27 @@ public function deleteRelation(APIVersionInfo $sourceVersion, ContentInfo $desti throw new UnauthorizedException('content', 'edit', ['contentId' => $sourceVersion->contentInfo->id]); } - $spiRelations = $this->persistenceHandler->contentHandler()->loadRelations( - $sourceVersion->getContentInfo()->id, + $spiRelationsCount = $this->persistenceHandler->contentHandler()->countRelations( + (int)$sourceVersion->getContentInfo()->getId(), $sourceVersion->versionNo, APIRelation::COMMON ); - if (empty($spiRelations)) { + if ($spiRelationsCount === 0) { throw new InvalidArgumentException( '$sourceVersion', 'There are no Relations of type COMMON for the given destination' ); } + $spiRelations = $this->persistenceHandler->contentHandler()->loadRelationList( + (int)$sourceVersion->getContentInfo()->getId(), + $spiRelationsCount, + 0, + $sourceVersion->versionNo, + APIRelation::COMMON + ); + // there should be only one relation of type COMMON for each destination, // but in case there were ever more then one, we will remove them all // @todo: alternatively, throw BadStateException? @@ -2650,7 +2666,7 @@ public function find(Filter $filter, ?array $languages = null): ContentList $contentItems[] = $this->contentDomainMapper->buildContentDomainObjectFromPersistence( $contentItem->content, $contentItem->type, - $languages, + $languages ?? [], ); } diff --git a/src/lib/Repository/Helper/NameSchemaService.php b/src/lib/Repository/Helper/NameSchemaService.php deleted file mode 100644 index 28f6fb0d19..0000000000 --- a/src/lib/Repository/Helper/NameSchemaService.php +++ /dev/null @@ -1,191 +0,0 @@ -settings = $settings + [ - 'limit' => 150, - 'sequence' => '...', - ]; - - parent::__construct( - $fieldTypeRegistry, - new SchemaIdentifierExtractor(), - $eventDispatcher, - $settings - ); - $this->contentTypeHandler = $contentTypeHandler; - $this->contentTypeDomainMapper = $contentTypeDomainMapper; - } - - public function resolveUrlAliasSchema(Content $content, ContentType $contentType = null): array - { - $contentType = $contentType ?? $content->getContentType(); - - return $this->resolveUrlAliasSchema( - $content, - $contentType - ); - } - - public function resolveContentNameSchema( - Content $content, - array $fieldMap = [], - array $languageCodes = [], - ContentType $contentType = null - ): array { - $contentType ??= $content->getContentType(); - - $languageCodes = $languageCodes ?: $content->versionInfo->languageCodes; - - return $this->resolveNameSchema( - $contentType->nameSchema, - $contentType, - $this->mergeFieldMap( - $content, - $fieldMap, - $languageCodes - ), - $languageCodes - ); - } - - public function resolveNameSchema( - string $nameSchema, - ContentType $contentType, - array $fieldMap, - array $languageCodes - ): array { - [$filteredNameSchema, $groupLookupTable] = $this->filterNameSchema($nameSchema); - $tokens = $this->extractTokens($filteredNameSchema); - $schemaIdentifiers = $this->getIdentifiers($nameSchema); - - $names = []; - - foreach ($languageCodes as $languageCode) { - // Fetch titles for language code - $titles = $this->getFieldTitles($schemaIdentifiers, $contentType, $fieldMap, $languageCode); - $name = $filteredNameSchema; - - // Replace tokens with real values - foreach ($tokens as $token) { - $string = $this->resolveToken($token, $titles, $groupLookupTable); - $name = str_replace($token, $string, $name); - } - $name = $this->validateNameLength($name); - - $names[$languageCode] = $name; - } - - return $names; - } - - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param array> $fieldMap - * @param array $languageCodes - * - * @return array> - */ - protected function mergeFieldMap(Content $content, array $fieldMap, array $languageCodes): array - { - $mergedFieldMap = []; - - foreach ($content->fields as $fieldIdentifier => $fieldLanguageMap) { - foreach ($languageCodes as $languageCode) { - $mergedFieldMap[$fieldIdentifier][$languageCode] = $fieldMap[$fieldIdentifier][$languageCode]; - } - } - - return $mergedFieldMap; - } - - /** - * Fetches the list of available Field identifiers in the token and returns - * an array of their current title value. - * - * @param array $schemaIdentifiers - * @param \Ibexa\Contracts\Core\Persistence\Content\Type|\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType - * @param array> $fieldMap - * @param string $languageCode - * - * @return array Key is the field identifier, value is the title value - * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType - * - * @see \Ibexa\Core\Repository\Values\ContentType\FieldType::getName() - */ - protected function getFieldTitles(array $schemaIdentifiers, $contentType, array $fieldMap, $languageCode): array - { - $fieldTitles = []; - - foreach ($schemaIdentifiers as $fieldDefinitionIdentifier) { - if (!isset($fieldMap[$fieldDefinitionIdentifier][$languageCode])) { - continue; - } - if ($contentType instanceof SPIContentType) { - $fieldDefinition = null; - foreach ($contentType->fieldDefinitions as $spiFieldDefinition) { - if ($spiFieldDefinition->identifier === $fieldDefinitionIdentifier) { - $fieldDefinition = $this->contentTypeDomainMapper->buildFieldDefinitionDomainObject( - $spiFieldDefinition, - // This is probably not main language, but as we don't expose it, it's ok for now. - $languageCode - ); - break; - } - } - if ($fieldDefinition === null) { - $fieldTitles[$fieldDefinitionIdentifier] = ''; - continue; - } - } elseif ($contentType instanceof ContentType) { - $fieldDefinition = $contentType->getFieldDefinition($fieldDefinitionIdentifier); - } else { - throw new InvalidArgumentType('$contentType', 'API or SPI variant of a content type'); - } - $fieldTypeService = $this->fieldTypeRegistry->getFieldType( - $fieldDefinition->fieldTypeIdentifier - ); - $fieldTitles[$fieldDefinitionIdentifier] = $fieldTypeService->getName( - $fieldMap[$fieldDefinitionIdentifier][$languageCode], - $fieldDefinition, - $languageCode - ); - } - - return $fieldTitles; - } -} diff --git a/src/lib/Repository/Helper/Readme.md b/src/lib/Repository/Helper/Readme.md deleted file mode 100644 index 80d5bfeada..0000000000 --- a/src/lib/Repository/Helper/Readme.md +++ /dev/null @@ -1,7 +0,0 @@ -# Helpers - -Collection of light helpers and services meant for internal use in Repository -and/or RepositoryServices. - -Given their use they can not rely on Repository or RepositoryServices as -that will lead to cyclic dependencies, they can only rely on SPI and other helpers. diff --git a/src/lib/Repository/Helper/RelationProcessor.php b/src/lib/Repository/Helper/RelationProcessor.php index 5ec1f8c1ff..5f9ea6af9b 100644 --- a/src/lib/Repository/Helper/RelationProcessor.php +++ b/src/lib/Repository/Helper/RelationProcessor.php @@ -190,6 +190,7 @@ public function processFieldRelations( switch ($relationType) { case Relation::FIELD: case Relation::ASSET: + /** @phpstan-var array $relationEntry */ foreach ($relationEntry as $relation) { $this->persistenceHandler->contentHandler()->removeRelation( $relation->id, @@ -200,6 +201,7 @@ public function processFieldRelations( break; case Relation::LINK: case Relation::EMBED: + /** @phpstan-var \Ibexa\Core\Repository\Values\Content\Relation $relationEntry */ $this->persistenceHandler->contentHandler()->removeRelation( $relationEntry->id, $relationType, diff --git a/src/lib/Repository/Helper/RoleDomainMapper.php b/src/lib/Repository/Helper/RoleDomainMapper.php deleted file mode 100644 index ab38758b66..0000000000 --- a/src/lib/Repository/Helper/RoleDomainMapper.php +++ /dev/null @@ -1,21 +0,0 @@ -getPathString()), new CriterionLogicalNot($contentReadCriterion), // Do not take the same content into consideration as it can have more than one location - new CriterionLogicalNot(new Criterion\ContentId($loadedSubtree->getContentInfo()->getId())), + new CriterionLogicalNot(new Criterion\ContentId((int)$loadedSubtree->getContentInfo()->getId())), ] ), ] diff --git a/src/lib/Repository/Mapper/ContentDomainMapper.php b/src/lib/Repository/Mapper/ContentDomainMapper.php index 6d107ed211..cba3fe720c 100644 --- a/src/lib/Repository/Mapper/ContentDomainMapper.php +++ b/src/lib/Repository/Mapper/ContentDomainMapper.php @@ -132,7 +132,7 @@ public function buildContentDomainObject( $mainLocation = $contentInfo->getMainLocation(); // For performance reasons 'countLocationsByContent' is moved to if - if ($mainLocation === null && $this->locationHandler->countLocationsByContent($contentInfo->getId()) > 0) { + if ($mainLocation === null && $this->locationHandler->countLocationsByContent((int)$contentInfo->getId()) > 0) { $this->logger->error( sprintf( 'Main location for content of ID = %d doesn\'t exist yet this content has locations assigned.', @@ -157,7 +157,7 @@ public function buildContentDomainObject( * * @param \Ibexa\Contracts\Core\Persistence\Content $spiContent * @param \Ibexa\Contracts\Core\Persistence\Content\Type $spiContentType - * @param string[] $prioritizedLanguages Prioritized language codes to filter fields on + * @param array $prioritizedLanguages Prioritized language codes to filter fields on * @param string|null $fieldAlwaysAvailableLanguage Language code fallback if a given field is not found in $prioritizedLanguages * * @return \Ibexa\Core\Repository\Values\Content\Content @@ -382,7 +382,7 @@ public function buildContentInfoDomainObject(SPIContentInfo $spiContentInfo) 'name' => $spiContentInfo->name, 'sectionId' => $spiContentInfo->sectionId, 'currentVersionNo' => $spiContentInfo->currentVersionNo, - 'published' => $spiContentInfo->isPublished, + 'published' => $spiContentInfo->status === ContentInfo::STATUS_PUBLISHED, 'ownerId' => $spiContentInfo->ownerId, 'modificationDate' => $spiContentInfo->modificationDate == 0 ? null : @@ -763,8 +763,6 @@ public function buildSPILocationCreateStruct( 'remoteId' => $remoteId, 'contentId' => $contentId, 'contentVersion' => $contentVersionNo, - // pathIdentificationString will be set in storage - 'pathIdentificationString' => null, 'mainLocationId' => $mainLocation, 'sortField' => $locationCreateStruct->sortField !== null ? $locationCreateStruct->sortField : Location::SORT_FIELD_NAME, 'sortOrder' => $locationCreateStruct->sortOrder !== null ? $locationCreateStruct->sortOrder : Location::SORT_ORDER_ASC, @@ -792,7 +790,6 @@ public function isValidLocationSortField($sortField): bool case APILocation::SORT_FIELD_CLASS_NAME: case APILocation::SORT_FIELD_PRIORITY: case APILocation::SORT_FIELD_NAME: - case APILocation::SORT_FIELD_MODIFIED_SUBNODE: case APILocation::SORT_FIELD_NODE_ID: case APILocation::SORT_FIELD_CONTENTOBJECT_ID: return true; diff --git a/src/lib/Repository/Permission/CachedPermissionService.php b/src/lib/Repository/Permission/CachedPermissionService.php index 1526653a45..36dabe0d14 100644 --- a/src/lib/Repository/Permission/CachedPermissionService.php +++ b/src/lib/Repository/Permission/CachedPermissionService.php @@ -13,7 +13,7 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver as APIPermissionResolver; use Ibexa\Contracts\Core\Repository\PermissionService; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult; use Ibexa\Contracts\Core\Repository\Values\User\UserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -52,7 +52,7 @@ class CachedPermissionService implements PermissionService * * Value is null if not yet set or cleared. * - * @var bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion + * @var bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface|null */ private $permissionCriterion; @@ -152,7 +152,7 @@ public function sudo(callable $callback, RepositoryInterface $outerRepository) return $returnValue; } - public function getQueryPermissionsCriterion(): Criterion + public function getQueryPermissionsCriterion(): CriterionInterface { return $this->permissionCriterionResolver->getQueryPermissionsCriterion(); } diff --git a/src/lib/Repository/Permission/PermissionCriterionResolver.php b/src/lib/Repository/Permission/PermissionCriterionResolver.php index 815c1881d9..9aa0880372 100644 --- a/src/lib/Repository/Permission/PermissionCriterionResolver.php +++ b/src/lib/Repository/Permission/PermissionCriterionResolver.php @@ -49,12 +49,6 @@ public function __construct( * * @uses \Ibexa\Contracts\Core\Repository\PermissionResolver::getCurrentUserReference() * @uses \Ibexa\Contracts\Core\Repository\PermissionResolver::hasAccess() - * - * @param string $module - * @param string $function - * @param array $targets - * - * @return bool|\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion */ public function getPermissionsCriterion(string $module = 'content', string $function = 'read', ?array $targets = null) { @@ -155,7 +149,7 @@ private function getCriterionForLimitation(Limitation $limitation, UserReference return $type->getCriterion($limitation, $currentUserRef); } - public function getQueryPermissionsCriterion(): Criterion + public function getQueryPermissionsCriterion(): CriterionInterface { // Permission Criterion handling work-around to avoid rewriting old architecture of perm. sys. $permissionCriterion = $this->getPermissionsCriterion( diff --git a/src/lib/Repository/Repository.php b/src/lib/Repository/Repository.php index 44723db8b6..b683f985dd 100644 --- a/src/lib/Repository/Repository.php +++ b/src/lib/Repository/Repository.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler; use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; +use Ibexa\Contracts\Core\Persistence\TransactionHandler; use Ibexa\Contracts\Core\Repository\BookmarkService as BookmarkServiceInterface; use Ibexa\Contracts\Core\Repository\ContentService as ContentServiceInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService as ContentTypeServiceInterface; @@ -30,7 +31,6 @@ use Ibexa\Contracts\Core\Repository\RoleService as RoleServiceInterface; use Ibexa\Contracts\Core\Repository\SearchService as SearchServiceInterface; use Ibexa\Contracts\Core\Repository\SectionService as SectionServiceInterface; -use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy; use Ibexa\Contracts\Core\Repository\TrashService as TrashServiceInterface; use Ibexa\Contracts\Core\Repository\URLAliasService as URLAliasServiceInterface; use Ibexa\Contracts\Core\Repository\URLService as URLServiceInterface; @@ -229,9 +229,6 @@ class Repository implements RepositoryInterface /** @var \Ibexa\Contracts\Core\Repository\PasswordHashService */ private $passwordHashService; - /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy */ - private $thumbnailStrategy; - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactory */ private $proxyDomainMapperFactory; @@ -261,6 +258,8 @@ class Repository implements RepositoryInterface private ConfigResolverInterface $configResolver; + private TransactionHandler $transactionHandler; + public function __construct( PersistenceHandler $persistenceHandler, SearchHandler $searchHandler, @@ -268,7 +267,6 @@ public function __construct( RelationProcessor $relationProcessor, FieldTypeRegistry $fieldTypeRegistry, PasswordHashService $passwordHashGenerator, - ThumbnailStrategy $thumbnailStrategy, ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory, Mapper\ContentDomainMapper $contentDomainMapper, Mapper\ContentTypeDomainMapper $contentTypeDomainMapper, @@ -283,6 +281,7 @@ public function __construct( PasswordValidatorInterface $passwordValidator, ConfigResolverInterface $configResolver, NameSchemaServiceInterface $nameSchemaService, + TransactionHandler $transactionHandler, array $serviceSettings = [], ?LoggerInterface $logger = null ) { @@ -292,7 +291,6 @@ public function __construct( $this->relationProcessor = $relationProcessor; $this->fieldTypeRegistry = $fieldTypeRegistry; $this->passwordHashService = $passwordHashGenerator; - $this->thumbnailStrategy = $thumbnailStrategy; $this->proxyDomainMapperFactory = $proxyDomainMapperFactory; $this->contentDomainMapper = $contentDomainMapper; $this->contentTypeDomainMapper = $contentTypeDomainMapper; @@ -334,6 +332,7 @@ public function __construct( $this->passwordValidator = $passwordValidator; $this->configResolver = $configResolver; $this->nameSchemaService = $nameSchemaService; + $this->transactionHandler = $transactionHandler; } public function sudo(callable $callback, ?RepositoryInterface $outerRepository = null) @@ -787,7 +786,7 @@ protected function getPermissionCriterionResolver(): PermissionCriterionResolver */ public function beginTransaction(): void { - $this->persistenceHandler->beginTransaction(); + $this->transactionHandler->beginTransaction(); } /** @@ -800,7 +799,7 @@ public function beginTransaction(): void public function commit(): void { try { - $this->persistenceHandler->commit(); + $this->transactionHandler->commit(); } catch (Exception $e) { throw new RuntimeException($e->getMessage(), 0, $e); } @@ -816,7 +815,7 @@ public function commit(): void public function rollback(): void { try { - $this->persistenceHandler->rollback(); + $this->transactionHandler->rollback(); } catch (Exception $e) { throw new RuntimeException($e->getMessage(), 0, $e); } diff --git a/src/lib/Repository/SearchService.php b/src/lib/Repository/SearchService.php index 448ce6320c..76555a3929 100644 --- a/src/lib/Repository/SearchService.php +++ b/src/lib/Repository/SearchService.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location as LocationCriterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalOperator; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Location as LocationSortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; use Ibexa\Contracts\Core\Search\Capable; @@ -168,7 +169,7 @@ protected function internalFindContentInfo(Query $query, array $languageFilter = $query = clone $query; $query->filter = $query->filter ?: new Criterion\MatchAll(); - $this->validateContentCriteria([$query->query], '$query'); + $this->validateContentCriteria($query->query ? [$query->query] : [], '$query'); $this->validateContentCriteria([$query->filter], '$query'); $this->validateContentSortClauses($query); @@ -184,7 +185,7 @@ protected function internalFindContentInfo(Query $query, array $languageFilter = * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion[] $criteria + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface[] $criteria * @param string $argumentName */ protected function validateContentCriteria(array $criteria, $argumentName) @@ -225,7 +226,7 @@ protected function validateContentSortClauses(Query $query) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if criterion is not valid * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if there is more than one result matching the criterions * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $filter + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface $filter * @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. * Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) * useAlwaysAvailable defaults to true to avoid exceptions on missing translations. @@ -233,7 +234,7 @@ protected function validateContentSortClauses(Query $query) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - public function findSingle(Criterion $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content + public function findSingle(CriterionInterface $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content { $this->validateContentCriteria([$filter], '$filter'); @@ -254,12 +255,9 @@ public function findSingle(Criterion $filter, array $languageFilter = [], bool $ /** * Suggests a list of values for the given prefix. * - * @param string $prefix * @param string[] $fieldPaths - * @param int $limit - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null $filter */ - public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, Criterion $filter = null) + public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, CriterionInterface $filter = null) { } @@ -315,12 +313,8 @@ public function findLocations(LocationQuery $query, array $languageFilter = [], * Adds content, read Permission criteria if needed and return false if no access at all. * * @uses \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver::getPermissionsCriterion() - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool */ - protected function addPermissionsCriterion(Criterion &$criterion): bool + protected function addPermissionsCriterion(Query\CriterionInterface &$criterion): bool { $permissionCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'read'); if ($permissionCriterion === true || $permissionCriterion === false) { diff --git a/src/lib/Repository/SectionService.php b/src/lib/Repository/SectionService.php index 5f4fd3d475..f49095a2a6 100644 --- a/src/lib/Repository/SectionService.php +++ b/src/lib/Repository/SectionService.php @@ -248,12 +248,6 @@ public function loadSectionByIdentifier(string $sectionIdentifier): Section /** * Counts the contents which $section is assigned to. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section - * - * @return int - * - * @deprecated since 6.0 */ public function countAssignedContents(Section $section): int { diff --git a/src/lib/Repository/SiteAccessAware/SearchService.php b/src/lib/Repository/SiteAccessAware/SearchService.php index d19abeaa49..d3651a7031 100644 --- a/src/lib/Repository/SiteAccessAware/SearchService.php +++ b/src/lib/Repository/SiteAccessAware/SearchService.php @@ -13,7 +13,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; /** @@ -67,7 +67,7 @@ public function findContentInfo(Query $query, array $languageFilter = [], bool $ return $this->service->findContentInfo($query, $languageFilter, $filterOnUserPermissions); } - public function findSingle(Criterion $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content + public function findSingle(CriterionInterface $filter, array $languageFilter = [], bool $filterOnUserPermissions = true): Content { $languageFilter['languages'] = $this->languageResolver->getPrioritizedLanguages( $languageFilter['languages'] ?? null @@ -80,7 +80,7 @@ public function findSingle(Criterion $filter, array $languageFilter = [], bool $ return $this->service->findSingle($filter, $languageFilter, $filterOnUserPermissions); } - public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, Criterion $filter = null) + public function suggest(string $prefix, array $fieldPaths = [], int $limit = 10, CriterionInterface $filter = null) { return $this->service->suggest($prefix, $fieldPaths, $limit, $filter); } diff --git a/src/lib/Repository/TrashService.php b/src/lib/Repository/TrashService.php index 92291e5ef9..771fd8805c 100644 --- a/src/lib/Repository/TrashService.php +++ b/src/lib/Repository/TrashService.php @@ -305,10 +305,6 @@ public function deleteTrashItem(APITrashItem $trashItem): TrashItemDeleteResult */ public function findTrashItems(Query $query): SearchResult { - if ($query->filter !== null && !$query->filter instanceof Criterion) { - throw new InvalidArgumentValue('query->filter', $query->filter, 'Query'); - } - if ($query->sortClauses !== null) { if (!is_array($query->sortClauses)) { throw new InvalidArgumentValue('query->sortClauses', $query->sortClauses, 'Query'); diff --git a/src/lib/Repository/User/PasswordHashService.php b/src/lib/Repository/User/PasswordHashService.php index 6f6edd8f30..598eab079b 100644 --- a/src/lib/Repository/User/PasswordHashService.php +++ b/src/lib/Repository/User/PasswordHashService.php @@ -8,14 +8,14 @@ namespace Ibexa\Core\Repository\User; -use Ibexa\Contracts\Core\Repository\PasswordHashService as APIPasswordHashService; +use Ibexa\Contracts\Core\Repository\PasswordHashService as PasswordHashServiceInterface; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Repository\User\Exception\UnsupportedPasswordHashType; /** * @internal */ -final class PasswordHashService implements APIPasswordHashService +final class PasswordHashService implements PasswordHashServiceInterface { private int $defaultHashType; diff --git a/src/lib/Resources/settings/repository/inner.yml b/src/lib/Resources/settings/repository/inner.yml index 006910c116..02f8f5df35 100644 --- a/src/lib/Resources/settings/repository/inner.yml +++ b/src/lib/Resources/settings/repository/inner.yml @@ -26,7 +26,6 @@ services: $relationProcessor: '@Ibexa\Core\Repository\Helper\RelationProcessor' $fieldTypeRegistry: '@Ibexa\Core\FieldType\FieldTypeRegistry' $passwordHashService: '@Ibexa\Core\Repository\User\PasswordHashService' - $thumbnailStrategy: '@Ibexa\Core\Repository\Strategy\ContentThumbnail\ThumbnailChainStrategy' $proxyDomainMapperFactory: '@Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactory' $contentDomainMapper: '@Ibexa\Core\Repository\Mapper\ContentDomainMapper' $contentTypeDomainMapper: '@Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper' @@ -40,6 +39,7 @@ services: $passwordValidator: '@Ibexa\Core\Repository\User\PasswordValidatorInterface' $configResolver: '@Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface' $nameSchemaService: '@Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface' + $transactionHandler: '@ibexa.repository.transaction_handler' Ibexa\Core\Repository\ContentService: class: Ibexa\Core\Repository\ContentService diff --git a/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php index b8d940d241..a15ffd61c8 100644 --- a/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Search\Common\EventSubscriber; +use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Events\Content\CopyContentEvent; use Ibexa\Contracts\Core\Repository\Events\Content\DeleteContentEvent; use Ibexa\Contracts\Core\Repository\Events\Content\DeleteTranslationEvent; @@ -65,7 +66,7 @@ public function onDeleteTranslation(DeleteTranslationEvent $event) $event->getContentInfo()->id ); - if (!$contentInfo->isPublished) { + if ($contentInfo->status !== ContentInfo::STATUS_PUBLISHED) { return; } @@ -123,7 +124,7 @@ public function onRevealContent(RevealContentEvent $event) public function onUpdateContentMetadata(UpdateContentMetadataEvent $event) { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContent()->id); - if (!$contentInfo->isPublished) { + if ($contentInfo->status !== ContentInfo::STATUS_PUBLISHED) { return; } $this->searchHandler->indexContent( diff --git a/src/lib/Search/Common/FieldNameResolver.php b/src/lib/Search/Common/FieldNameResolver.php index e1c7847048..ff4cc2b10f 100644 --- a/src/lib/Search/Common/FieldNameResolver.php +++ b/src/lib/Search/Common/FieldNameResolver.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CustomFieldInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use RuntimeException; @@ -94,7 +95,6 @@ protected function getSearchableFieldMap() * @see \Ibexa\Contracts\Core\Repository\Values\Content\Query\CustomFieldInterface * @see \Ibexa\Contracts\Core\FieldType\Indexable * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param string $fieldDefinitionIdentifier * @param string|null $fieldTypeIdentifier * @param string|null $name @@ -102,7 +102,7 @@ protected function getSearchableFieldMap() * @return string[] */ public function getFieldNames( - Criterion $criterion, + CriterionInterface $criterion, $fieldDefinitionIdentifier, $fieldTypeIdentifier = null, $name = null @@ -123,7 +123,6 @@ public function getFieldNames( * @see \Ibexa\Contracts\Core\Repository\Values\Content\Query\CustomFieldInterface * @see \Ibexa\Contracts\Core\FieldType\Indexable * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param string $fieldDefinitionIdentifier * @param string|null $fieldTypeIdentifier * @param string|null $name @@ -131,7 +130,7 @@ public function getFieldNames( * @return array */ public function getFieldTypes( - Criterion $criterion, + CriterionInterface $criterion, $fieldDefinitionIdentifier, $fieldTypeIdentifier = null, $name = null diff --git a/src/lib/Search/Common/IncrementalIndexer.php b/src/lib/Search/Common/IncrementalIndexer.php index 0dff198bfc..e9a3abc351 100644 --- a/src/lib/Search/Common/IncrementalIndexer.php +++ b/src/lib/Search/Common/IncrementalIndexer.php @@ -7,10 +7,6 @@ namespace Ibexa\Core\Search\Common; -use Doctrine\DBAL\FetchMode; -use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Output\OutputInterface; - /** * Base class for the Search Engine Indexer Service aimed to recreate Search Engine Index. * Each Search Engine has to extend it on its own. @@ -24,44 +20,6 @@ */ abstract class IncrementalIndexer extends Indexer { - /** - * @deprecated Kept for compatibility with consumers of Indexer, performs purge first & recreate of index second. - */ - final public function createSearchIndex(OutputInterface $output, $iterationCount, $commit) - { - $output->writeln('Re-creating search index for: ' . $this->getName()); - $output->writeln('Purging Index...'); - $this->searchHandler->purgeIndex(); - - $stmt = $this->getContentDbFieldsStmt(['count(id)']); - $totalCount = (int) ($stmt->fetchColumn()); - $stmt = $this->getContentDbFieldsStmt(['id']); - - $output->writeln("Re-creating search engine index for {$totalCount} content items..."); - $progress = new ProgressBar($output); - $progress->start($totalCount); - - $i = 0; - do { - $contentIds = []; - for ($k = 0; $k <= $iterationCount; ++$k) { - if (!$row = $stmt->fetch(FetchMode::ASSOCIATIVE)) { - break; - } - - $contentIds[] = $row['id']; - } - - $this->updateSearchIndex($contentIds, $commit); - - $progress->advance($k); - } while (($i += $iterationCount) < $totalCount); - - $progress->finish(); - $output->writeln(''); - $output->writeln('Finished creating Search Engine Index'); - } - /** * Updates search engine index based on Content id's. * diff --git a/src/lib/Search/Common/Indexer.php b/src/lib/Search/Common/Indexer.php index d734d0d233..064af65d46 100644 --- a/src/lib/Search/Common/Indexer.php +++ b/src/lib/Search/Common/Indexer.php @@ -14,7 +14,6 @@ use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Psr\Log\LoggerInterface; -use Symfony\Component\Console\Output\OutputInterface; /** * Base class for the Search Engine Indexer Service aimed to recreate Search Engine Index. @@ -46,15 +45,6 @@ public function __construct( $this->searchHandler = $searchHandler; } - /** - * Create search engine index. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param int $iterationCount - * @param bool $commit commit changes after each iteration - */ - abstract public function createSearchIndex(OutputInterface $output, $iterationCount, $commit); - /** * Get DB Statement to fetch metadata about content objects to be indexed. * diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php index 19df4910dd..5aab74e911 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * Content locator gateway implementation using the DoctrineDatabase. @@ -54,7 +55,7 @@ public function addHandler(CriterionHandler $handler) */ public function convertCriteria( QueryBuilder $query, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { foreach ($this->handlers as $handler) { @@ -64,7 +65,7 @@ public function convertCriteria( } throw new NotImplementedException( - 'No visitor available for: ' . get_class($criterion) . ' with operator ' . $criterion->operator + 'No visitor available for: ' . get_class($criterion) ); } } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php index d1f0fa520f..cbf0535df6 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; abstract class CriterionHandler { @@ -47,11 +48,11 @@ public function __construct(Connection $connection) /** * Check if this criterion handler accepts to handle the given criterion. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface $criterion * * @return bool */ - abstract public function accept(Criterion $criterion); + abstract public function accept(CriterionInterface $criterion); /** * Generate query expression for a Criterion this handler accepts. @@ -68,7 +69,7 @@ abstract public function accept(Criterion $criterion); abstract public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/CompositeCriterion.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/CompositeCriterion.php index 6547678b7d..27b561d94a 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/CompositeCriterion.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/CompositeCriterion.php @@ -10,20 +10,24 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class CompositeCriterion extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\CompositeCriterion; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\CompositeCriterion $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { return $converter->convertCriteria($queryBuilder, $criterion->criteria, $languageSettings); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php index c8fae82af7..c6030aec13 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ContentId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ContentId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentName.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentName.php index 63314e961c..0834075ad5 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentName.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentName.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -22,7 +23,7 @@ final class ContentName extends CriterionHandler private const CONTENTOBJECT_NAME_ALIAS = 'ezc_n'; private const CONTENTOBJECT_ALIAS = 'c'; - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ContentName && $criterion->operator === Criterion\Operator::LIKE; @@ -33,13 +34,14 @@ public function accept(Criterion $criterion): bool * languages: array, * useAlwaysAvailable: bool, * } $languageSettings + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentName $criterion * * @throws \Doctrine\DBAL\Exception */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { $subQuery = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php index 02547bfca3..399462bf94 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeGroupId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ContentTypeGroupId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ContentTypeGroupId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeGroupId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php index 52e80800aa..9ac4d29a90 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ContentTypeId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ContentTypeId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { return $queryBuilder->expr()->in( diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php index 77d83b24ec..bb8118e84e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use Psr\Log\LoggerInterface; @@ -45,22 +46,18 @@ public function __construct( $this->logger = $logger ?? new NullLogger(); } - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ContentTypeIdentifier; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $idList = []; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php index 6043125359..61a8e00348 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.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\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use RuntimeException; @@ -20,22 +21,18 @@ */ class DateMetadata extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\DateMetadata; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\DateMetadata $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $column = $this->getColumnName($criterion); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php index 1e3552950c..ef02608d96 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; @@ -60,14 +61,7 @@ public function __construct( $this->transformationProcessor = $transformationProcessor; } - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Field; } @@ -118,8 +112,7 @@ protected function getFieldsInformation($fieldIdentifier) /** * @param array $languageSettings - * - * @return string + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Field $criterion * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException If no searchable fields are found for the given criterion target. * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException @@ -129,7 +122,7 @@ protected function getFieldsInformation($fieldIdentifier) public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { $fieldsInformation = $this->getFieldsInformation($criterion->target); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php index 21a37a69ff..9a6dd3ac77 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; @@ -52,7 +53,7 @@ public function __construct( /** * Check if this criterion handler accepts to handle the given criterion. */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\IsFieldEmpty; } @@ -97,10 +98,13 @@ protected function getFieldsInformation(string $fieldIdentifier): array return $fieldMapArray; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsFieldEmpty $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { $fieldsInformation = $this->getFieldsInformation($criterion->target); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php index 3b798c252b..d2ac6395ec 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.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\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; @@ -30,14 +31,7 @@ class FieldRelation extends FieldBase */ private const CONTENT_ITEM_REL_COLUMN = 'c_rel.to_contentobject_id'; - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\FieldRelation; } @@ -75,10 +69,13 @@ protected function getFieldDefinitionsIds($fieldDefinitionIdentifier) return $fieldDefinitionIdList; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\FieldRelation $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $fieldDefinitionIds = $this->getFieldDefinitionsIds($criterion->target); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php index 6fdb81452d..b6e2bb0cee 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.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\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; @@ -114,14 +115,7 @@ public function __construct( $this->languageMaskGenerator = $languageMaskGenerator; } - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\FullText; } @@ -204,10 +198,13 @@ protected function getWordIdSubquery(QueryBuilder $query, string $string): strin return $subQuery->getSQL(); } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\FullText $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); 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 80189c186e..cbd61c9a96 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsContainer.php @@ -11,24 +11,27 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; 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; final class IsContainer extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\IsContainer; } /** * @phpstan-param array{languages: string[]} $languageSettings + * + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsContainer $criterion */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { /** @var array{bool} $criterionValue */ diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserBased.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserBased.php index 08c3502515..5b5fc28b51 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserBased.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserBased.php @@ -10,20 +10,24 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class IsUserBased extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\IsUserBased; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsUserBased $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $isUserBased = (bool)reset($criterion->value); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php index dd237ff154..6e9279b446 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php @@ -10,21 +10,25 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\FieldType\User\UserStorage\Gateway\DoctrineStorage as UserGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class IsUserEnabled extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\IsUserEnabled; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsUserEnabled $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php index aaf4b82ca4..8375c77e6b 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -29,22 +30,18 @@ public function __construct(Connection $connection, MaskGenerator $maskGenerator $this->maskGenerator = $maskGenerator; } - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LanguageCode; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { /* @var $criterion \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php index cbab0be9cd..6e425e45f8 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalAnd.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,22 +18,18 @@ */ class LogicalAnd extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LogicalAnd; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subexpressions = []; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php index 74ec2dc92e..b2593c7c09 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalNot.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,22 +18,18 @@ */ class LogicalNot extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LogicalNot; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalNot $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { return sprintf( diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php index dad5e7baac..ba7897a96a 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LogicalOr.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,22 +18,18 @@ */ class LogicalOr extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LogicalOr; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalOr $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subexpressions = []; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php index 9b9db1d121..f8945726b9 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Value\MapLocationValue; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use RuntimeException; @@ -30,14 +31,7 @@ class MapLocationDistance extends FieldBase */ public const EARTH_RADIUS = 6371.01; - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\MapLocationDistance; } @@ -85,10 +79,13 @@ protected function kilometersToDegrees($kilometers): float return $kilometers / self::DEGREE_KM; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MapLocationDistance $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $fieldDefinitionIds = $this->getFieldDefinitionIds($criterion->target); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php index 81b826e920..db0124098a 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchAll.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,14 +18,7 @@ */ class MatchAll extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\MatchAll; } @@ -32,7 +26,7 @@ public function accept(Criterion $criterion): bool public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { return '1 = 1'; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php index 2b0e08ec4e..beaa4bbaa2 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MatchNone.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,14 +18,7 @@ */ class MatchNone extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\MatchNone; } @@ -32,7 +26,7 @@ public function accept(Criterion $criterion): bool public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ): string { return '1 = 0'; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php index 58e5962b87..ba78111c61 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ObjectStateId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ObjectStateId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ObjectStateId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateIdentifier.php index 8a7c03c15d..4ef01b0d37 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ObjectStateIdentifier.php @@ -11,20 +11,24 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class ObjectStateIdentifier extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ObjectStateIdentifier; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ObjectStateIdentifier $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php index dc65edc995..228864db54 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/RemoteId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class RemoteId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\RemoteId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\RemoteId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $remoteIds = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php index 240875851c..9c8b41ffcc 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class SectionId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\SectionId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\SectionId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $sectionIds = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionIdentifier.php index 83355eae49..930c8719be 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/SectionIdentifier.php @@ -11,20 +11,24 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class SectionIdentifier extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\SectionIdentifier; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\SectionIdentifier $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php index 94cb9b66b9..8ce58368ee 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\TransformationProcessor; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -29,15 +30,18 @@ public function __construct( $this->transformationProcessor = $transformationProcessor; } - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\UserEmail; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserEmail $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { if (Criterion\Operator::LIKE === $criterion->operator) { diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserId.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserId.php index ce8f2e068b..d86a111cad 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserId.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserId.php @@ -11,21 +11,25 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\FieldType\User\UserStorage\Gateway\DoctrineStorage as UserGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; class UserId extends CriterionHandler { - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\UserId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php index 2a310c912a..443fef7ae9 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\TransformationProcessor; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -29,15 +30,18 @@ public function __construct( $this->transformationProcessor = $transformationProcessor; } - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\UserLogin; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserLogin $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $expr = $queryBuilder->expr(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php index c03328c58d..d3007421b9 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.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\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -21,22 +22,18 @@ */ class UserMetadata extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\UserMetadata; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserMetadata $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Gateway.php b/src/lib/Search/Legacy/Content/Gateway.php index 86d82f71e6..78b0f5bb1d 100644 --- a/src/lib/Search/Legacy/Content/Gateway.php +++ b/src/lib/Search/Legacy/Content/Gateway.php @@ -7,7 +7,7 @@ namespace Ibexa\Core\Search\Legacy\Content; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * The Content Search Gateway provides the implementation for one database to @@ -18,7 +18,7 @@ abstract class Gateway /** * Returns a list of object satisfying the $criterion. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface $criterion * @param int $offset * @param int $limit * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $sort @@ -31,7 +31,7 @@ abstract class Gateway * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException if a given Criterion Handler or Sort Clause is not implemented */ abstract public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset, $limit, array $sort = null, diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php index 4ebbb3ece3..93704c7e10 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -17,22 +18,18 @@ */ class Ancestor extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Ancestor; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $idSet = []; diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php index 650d1f05e6..0761957f3e 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class LocationId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LocationId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $locationIds = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php index 5fa2e4807d..d51bdfd8d0 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/LocationRemoteId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class LocationRemoteId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LocationRemoteId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationRemoteId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php index 601ed99448..4e7adf864d 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/ParentLocationId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ParentLocationId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ParentLocationId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php index 8831758130..eff6b55752 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php @@ -8,7 +8,7 @@ namespace Ibexa\Core\Search\Legacy\Content\Gateway\CriterionHandler; use Doctrine\DBAL\Query\QueryBuilder; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway; use Ibexa\Core\Repository\Values\Content\Query\Criterion\PermissionSubtree as PermissionSubtreeCriterion; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; @@ -19,22 +19,18 @@ */ class PermissionSubtree extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof PermissionSubtreeCriterion; } + /** + * @param \Ibexa\Core\Repository\Values\Content\Query\Criterion\PermissionSubtree $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $table = 'permission_subtree'; diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php index a9bf894204..0f830935e8 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Subtree.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class Subtree extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Subtree; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Subtree $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $statements = []; diff --git a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php index 38df55345b..84d745e291 100644 --- a/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php +++ b/src/lib/Search/Legacy/Content/Gateway/CriterionHandler/Visibility.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class Visibility extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Visibility; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Visibility $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $subSelect = $this->connection->createQueryBuilder(); diff --git a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php index 36795787d7..30113aad04 100644 --- a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php @@ -13,7 +13,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway; @@ -71,7 +71,7 @@ public function __construct( } public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset, $limit, array $sort = null, @@ -127,7 +127,7 @@ private function getLanguageMask(array $languageSettings): int * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ private function getQueryCondition( - Criterion $filter, + CriterionInterface $filter, QueryBuilder $query, array $languageFilter ) { @@ -166,14 +166,11 @@ private function getQueryCondition( } /** - * Get result count. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $filter * @param array $languageFilter * * @return int */ - private function getResultCount(Criterion $filter, array $languageFilter): int + private function getResultCount(CriterionInterface $filter, array $languageFilter): int { $query = $this->connection->createQueryBuilder(); @@ -210,7 +207,7 @@ private function getResultCount(Criterion $filter, array $languageFilter): int * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ private function getContentInfoList( - Criterion $filter, + CriterionInterface $filter, ?array $sort, ?int $offset, ?int $limit, diff --git a/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php b/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php index a0f3e2c66c..6415ac3b87 100644 --- a/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php +++ b/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php @@ -8,7 +8,7 @@ namespace Ibexa\Core\Search\Legacy\Content\Gateway; use Doctrine\DBAL\DBALException; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\DatabaseException; use Ibexa\Core\Search\Legacy\Content\Gateway; use PDOException; @@ -30,7 +30,7 @@ public function __construct(Gateway $innerGateway) } public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset = 0, $limit = null, array $sort = null, diff --git a/src/lib/Search/Legacy/Content/Handler.php b/src/lib/Search/Legacy/Content/Handler.php index ceea66df95..20c8890f0d 100644 --- a/src/lib/Search/Legacy/Content/Handler.php +++ b/src/lib/Search/Legacy/Content/Handler.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; use Ibexa\Contracts\Core\Search\VersatileHandler as SearchHandlerInterface; @@ -201,19 +202,19 @@ protected function extractMatchedLanguage($languageMask, $mainLanguageId, $langu /** * Performs a query for a single content object. * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if Criterion is not applicable to its target - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if there is more than than one result matching the criterions - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $filter + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface $filter * @param array $languageFilter - a map of language related filters specifying languages query will be performed on. * Also used to define which field languages are loaded for the returned content. * Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) * useAlwaysAvailable defaults to true to avoid exceptions on missing translations * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if Criterion is not applicable to its target + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException if there is more than than one result matching the criterions */ - public function findSingle(Criterion $filter, array $languageFilter = []) + public function findSingle(CriterionInterface $filter, array $languageFilter = []) { if (!isset($languageFilter['languages'])) { $languageFilter['languages'] = []; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway.php b/src/lib/Search/Legacy/Content/Location/Gateway.php index 9223e72f49..2bf572b007 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway.php @@ -7,7 +7,7 @@ namespace Ibexa\Core\Search\Legacy\Content\Location; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; /** * Base class for location search gateways. @@ -17,7 +17,6 @@ abstract class Gateway /** * Returns total count and data for all Locations satisfying the parameters. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param int $offset * @param int $limit * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $sortClauses @@ -30,7 +29,7 @@ abstract class Gateway * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException if a given Criterion Handler or Sort Clause is not implemented */ abstract public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset, $limit, array $sortClauses = null, diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php index 1414e5d66a..0189a5d0cf 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Ancestor.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class Ancestor extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Ancestor; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $idSet = []; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php index 8b916642d3..4f04e0aa7a 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Depth.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use RuntimeException; @@ -19,22 +20,18 @@ */ class Depth extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Location\Depth; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Depth $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $column = 't.depth'; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php index 8fa14d3ab2..e5263adb52 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -31,7 +32,7 @@ public function __construct( $this->permissionResolver = $permissionResolver; } - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Location\IsBookmarked && $criterion->operator === Criterion\Operator::EQ; @@ -39,11 +40,12 @@ public function accept(Criterion $criterion): bool /** * @param array{languages: string[]} $languageSettings + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsBookmarked $criterion */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { if (!is_array($criterion->value)) { diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php index eb8df8ef18..26c20f5597 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use RuntimeException; @@ -18,22 +19,18 @@ */ class IsMainLocation extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Location\IsMainLocation; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsMainLocation $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $idColumn = 't.node_id'; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php index 7105498bee..0e4dc7ab58 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/Priority.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use RuntimeException; @@ -19,22 +20,18 @@ */ class Priority extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Location\Priority; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Priority $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $column = 'priority'; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php index ced1e322d8..aa48c62001 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class LocationId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LocationId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php index 8ea97ca833..4bc815445b 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/LocationRemoteId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class LocationRemoteId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\LocationRemoteId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationRemoteId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php index f3ef44ee92..5c59deb3e3 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/ParentLocationId.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,22 +19,18 @@ */ class ParentLocationId extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\ParentLocationId; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $value = (array)$criterion->value; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php index 0947a19c81..079332158f 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Subtree.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -18,10 +19,13 @@ */ class Subtree extends CriterionHandler { + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Subtree $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $statements = []; @@ -35,14 +39,7 @@ public function handle( return $queryBuilder->expr()->orX(...$statements); } - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Subtree; } diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php index d8fe2ce645..850368919f 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; use RuntimeException; @@ -19,22 +20,18 @@ */ class Visibility extends CriterionHandler { - /** - * Check if this criterion handler accepts to handle the given criterion. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * - * @return bool - */ - public function accept(Criterion $criterion): bool + public function accept(CriterionInterface $criterion): bool { return $criterion instanceof Criterion\Visibility; } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Visibility $criterion + */ public function handle( CriteriaConverter $converter, QueryBuilder $queryBuilder, - Criterion $criterion, + CriterionInterface $criterion, array $languageSettings ) { $column = 't.is_invisible'; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php index db6a08f7b2..45a687a0ee 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php @@ -11,7 +11,7 @@ use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter; @@ -67,7 +67,7 @@ public function __construct( } public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset, $limit, array $sortClauses = null, @@ -166,13 +166,12 @@ public function find( /** * Returns total results count for $criterion and $sortClauses. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param array $languageFilter * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function getTotalCount(Criterion $criterion, array $languageFilter): int + private function getTotalCount(CriterionInterface $criterion, array $languageFilter): int { $query = $this->connection->createQueryBuilder(); $query diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php b/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php index 1153016660..a01350b25e 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php @@ -8,7 +8,7 @@ namespace Ibexa\Core\Search\Legacy\Content\Location\Gateway; use Doctrine\DBAL\DBALException; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\DatabaseException; use Ibexa\Core\Search\Legacy\Content\Location\Gateway; use PDOException; @@ -36,7 +36,7 @@ public function __construct(Gateway $innerGateway) } public function find( - Criterion $criterion, + CriterionInterface $criterion, $offset = 0, $limit = null, array $sortClauses = null, diff --git a/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php b/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php index 0da64ce74d..9de34fb626 100644 --- a/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php +++ b/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php @@ -95,7 +95,7 @@ public function testIndexing(array $values = null, $logger = null) ->expects(self::once()) ->method('loadContentInfo') ->with(33) - ->willReturn(new ContentInfo(['id' => 33, 'currentVersionNo' => 2, 'isPublished' => true])); + ->willReturn(new ContentInfo(['id' => 33, 'currentVersionNo' => 2, 'status' => ContentInfo::STATUS_PUBLISHED])); $contentHandlerMock ->expects(self::once()) @@ -143,7 +143,7 @@ public function testIndexing(array $values = null, $logger = null) public function indexDeleteProvider() { $location = new Location(['id' => 44, 'contentId' => 33]); - $info = new ContentInfo(['id' => 33, 'currentVersionNo' => 2, 'isPublished' => true]); + $info = new ContentInfo(['id' => 33, 'currentVersionNo' => 2, 'status' => ContentInfo::STATUS_PUBLISHED]); $infoReturn = self::returnValue($info); $infoReturnUnPublished = self::returnValue(new ContentInfo(['id' => 33, 'currentVersionNo' => 2])); diff --git a/tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php b/tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php index 85239fbc36..db7817e933 100644 --- a/tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php +++ b/tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php @@ -78,7 +78,6 @@ private function createTestContent(): Content private function addToBookmark(Location $location): Bookmark { $createStruct = new CreateStruct(); - $createStruct->name = ''; $createStruct->userId = self::ADMIN_USER_ID; $createStruct->locationId = $location->id; diff --git a/tests/integration/Core/Repository/ContentServiceTest.php b/tests/integration/Core/Repository/ContentServiceTest.php index 5ec286ff98..fb21357fdf 100644 --- a/tests/integration/Core/Repository/ContentServiceTest.php +++ b/tests/integration/Core/Repository/ContentServiceTest.php @@ -3260,7 +3260,7 @@ public function testLoadVersions() self::assertEquals($expectedVersionsOrder, $versions); - return $versions; + return iterator_to_array($versions); } /** @@ -6055,7 +6055,7 @@ public function testLoadVersionsOfStatusDraft() $versions = $this->contentService->loadVersions($content->contentInfo, VersionInfo::STATUS_DRAFT); - self::assertSame(\count($versions), 3); + self::assertSame(\iterator_count($versions), 3); } /** @@ -6073,7 +6073,7 @@ public function testLoadVersionsOfStatusArchived() $versions = $this->contentService->loadVersions($content->contentInfo, VersionInfo::STATUS_ARCHIVED); - self::assertSame(\count($versions), 2); + self::assertSame(\iterator_count($versions), 2); } /** diff --git a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php index 5019f52ad4..c333496114 100644 --- a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php @@ -368,7 +368,6 @@ public function provideToHashData(): array ), [ 'inputUri' => $path, - 'path' => $path, 'fileName' => 'Icy-Night-Flower.jpg', 'alternativeText' => 'My icy flower at night', 'fileSize' => null, @@ -397,7 +396,6 @@ public function provideToHashData(): array ), [ 'id' => $path, - 'path' => $path, 'fileName' => 'Icy-Night-Flower.jpg', 'alternativeText' => 'My icy flower at night', 'fileSize' => 23, diff --git a/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php index 3bd9445f90..e6d49c1a19 100644 --- a/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php @@ -1175,11 +1175,8 @@ public function testFindNotLikeTwo($valueOne, $valueTwo, $filter, $content, $mod * * $fieldName refers to additional field (to the default field) defined in Indexable definition, * and is resolved using FieldNameResolver. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * @param string $fieldName */ - protected function modifyFieldCriterion(Criterion $criterion, $fieldName) + protected function modifyFieldCriterion(Query\CriterionInterface $criterion, string $fieldName): void { $setupFactory = $this->getSetupFactory(); /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */ @@ -1232,10 +1229,9 @@ protected function modifyFieldSortClause(SortClause $sortClause, $fieldName) * * Implemented separately to utilize recursion. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion[]|\Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $criteriaOrSortClauses - * @param string $fieldName + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface[]|\Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion[]|\Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $criteriaOrSortClauses */ - protected function doModifyField(array $criteriaOrSortClauses, $fieldName) + protected function doModifyField(array $criteriaOrSortClauses, string $fieldName): void { foreach ($criteriaOrSortClauses as $criterionOrSortClause) { if ($criterionOrSortClause instanceof LogicalOperator) { @@ -1357,13 +1353,9 @@ public function testFullTextFindTwo($valueOne, $valueTwo, $filter, $content, arr /** * Returns SearchResult of the tested Content for the given $criterion. * - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param bool $filter Denotes search by filtering if true, search by querying if false - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult */ - protected function findContent(Repository $repository, Criterion $criterion, $filter) + protected function findContent(Repository $repository, Query\CriterionInterface $criterion, bool $filter): SearchResult { $searchService = $repository->getSearchService(); @@ -1414,13 +1406,11 @@ protected function sortContent(Repository $repository, SortClause $sortClause) /** * Returns SearchResult of the tested Locations for the given $criterion. * - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param bool $filter Denotes search by filtering if true, search by querying if false * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult */ - protected function findLocations(Repository $repository, Criterion $criterion, $filter) + protected function findLocations(Repository $repository, Query\CriterionInterface $criterion, $filter) { $searchService = $repository->getSearchService(); @@ -1507,21 +1497,15 @@ protected function getResultContentIdList(SearchResult $searchResult) * Search result can be empty, contain both Content One and Content Two or only one of them. * * @param array $context - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion - * @param bool $includesOne - * @param bool $includesTwo - * @param bool $filter - * @param bool $content - * @param string|null $modifyField */ protected function assertFindResult( array $context, - Criterion $criterion, - $includesOne, - $includesTwo, - $filter, - $content, - $modifyField + Query\CriterionInterface $criterion, + bool $includesOne, + bool $includesTwo, + bool $filter, + bool $content, + ?string $modifyField ) { [$repository, $contentOneId, $contentTwoId] = $context; diff --git a/tests/integration/Core/Repository/SearchServiceImageTest.php b/tests/integration/Core/Repository/SearchServiceImageTest.php index 8c8de7c906..e9b589aa3e 100644 --- a/tests/integration/Core/Repository/SearchServiceImageTest.php +++ b/tests/integration/Core/Repository/SearchServiceImageTest.php @@ -356,7 +356,7 @@ private function createContentImage( $imageValue = new ImageValue(); $imageValue->fileName = $fileName; - $imageValue->path = $path; + $imageValue->inputUri = $path; $contentCreateStruct->setField('name', new TextValue('Image'), 'eng-GB'); $contentCreateStruct->setField('image', $imageValue, 'eng-GB'); diff --git a/tests/integration/Core/Repository/SearchServiceLocationTest.php b/tests/integration/Core/Repository/SearchServiceLocationTest.php index 4974ea32d9..9381c5fc10 100644 --- a/tests/integration/Core/Repository/SearchServiceLocationTest.php +++ b/tests/integration/Core/Repository/SearchServiceLocationTest.php @@ -524,6 +524,7 @@ public function testQueryModifiedField() 'sortClauses' => [new SortClause\ContentId()], ] ); + self::assertInstanceOf(Criterion::class, $query->query); $query->query->setCustomField('user', 'first_name', 'custom_field'); $this->assertQueryFixture( diff --git a/tests/integration/Core/Repository/SearchServiceTest.php b/tests/integration/Core/Repository/SearchServiceTest.php index a54b2e5c3a..fa547e7904 100644 --- a/tests/integration/Core/Repository/SearchServiceTest.php +++ b/tests/integration/Core/Repository/SearchServiceTest.php @@ -2930,6 +2930,7 @@ public function testQueryModifiedField() 'sortClauses' => [new SortClause\ContentId()], ] ); + self::assertInstanceOf(Criterion::class, $query->query); $query->query->setCustomField('user', 'first_name', 'custom_field'); $this->assertQueryFixture( @@ -4861,15 +4862,21 @@ protected function simplifySearchResult(SearchResult $result) switch (true) { case $hit->valueObject instanceof Content: case $hit->valueObject instanceof Location: + /** @phpstan-ignore assign.propertyType */ $hit->valueObject = [ - 'id' => $hit->valueObject->contentInfo->id, - 'title' => $hit->valueObject->contentInfo->name, + /** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\Ibexa\Contracts\Core\Repository\Values\Content\Content $hit->valueObject */ + 'id' => $hit->valueObject->contentInfo->getId(), + /** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\Ibexa\Contracts\Core\Repository\Values\Content\Content $hit->valueObject */ + 'title' => $hit->valueObject->contentInfo->getName(), ]; break; case $hit->valueObject instanceof ContentInfo: + /** @phpstan-ignore assign.propertyType */ $hit->valueObject = [ + /** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $hit->valueObject */ 'id' => $hit->valueObject->id, + /** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $hit->valueObject */ 'title' => $hit->valueObject->name, ]; break; diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index ea81a7caf3..a15395812c 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -356,7 +356,6 @@ public function provideInputForToHash() ), [ 'id' => $this->getImageInputPath(), - 'path' => $this->getImageInputPath(), 'fileName' => 'Sindelfingen-Squirrels.jpg', 'fileSize' => 23, 'alternativeText' => 'This is so Sindelfingen!', @@ -369,11 +368,10 @@ public function provideInputForToHash() 'mime' => 'image/jpeg', ], ], - // BC with 5.0 (EZP-20948). Path can be used as input instead of $inputUri. [ new ImageValue( [ - 'path' => $this->getImageInputPath(), + 'inputUri' => $this->getImageInputPath(), 'fileName' => 'Sindelfingen-Squirrels.jpg', 'fileSize' => 23, 'alternativeText' => 'This is so Sindelfingen!', @@ -384,7 +382,6 @@ public function provideInputForToHash() ), [ 'id' => null, - 'path' => $this->getImageInputPath(), 'fileName' => 'Sindelfingen-Squirrels.jpg', 'fileSize' => 23, 'alternativeText' => 'This is so Sindelfingen!', @@ -463,7 +460,7 @@ public function provideInputForFromHash() // BC with 5.0 (EZP-20948). Path can be used as input instead of ID. [ [ - 'path' => $this->getImageInputPath(), + 'inputUri' => $this->getImageInputPath(), 'fileName' => 'Sindelfingen-Squirrels.jpg', 'fileSize' => 23, 'alternativeText' => 'This is so Sindelfingen!', @@ -924,7 +921,6 @@ public function provideInputForValuesEqual(): array new ImageValue( [ 'id' => $this->getImageInputPath(), - 'path' => $this->getImageInputPath(), 'fileName' => 'Sindelfingen-Squirrels.jpg', 'fileSize' => 23, 'alternativeText' => 'This is so Sindelfingen!', diff --git a/tests/lib/Helper/FieldHelperTest.php b/tests/lib/Helper/FieldHelperTest.php index 9e7adbc324..02de654da1 100644 --- a/tests/lib/Helper/FieldHelperTest.php +++ b/tests/lib/Helper/FieldHelperTest.php @@ -7,7 +7,6 @@ namespace Ibexa\Tests\Core\Helper; -use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Contracts\Core\Repository\Values\Content\Content as APIContent; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -29,9 +28,6 @@ class FieldHelperTest extends TestCase /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService|\PHPUnit\Framework\MockObject\MockObject */ private $fieldTypeServiceMock; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentTypeServiceMock; - /** @var \Ibexa\Core\Helper\TranslationHelper|\PHPUnit\Framework\MockObject\MockObject */ private $translationHelper; @@ -39,9 +35,8 @@ protected function setUp(): void { parent::setUp(); $this->fieldTypeServiceMock = $this->createMock(FieldTypeService::class); - $this->contentTypeServiceMock = $this->createMock(ContentTypeService::class); $this->translationHelper = $this->createMock(TranslationHelper::class); - $this->fieldHelper = new FieldHelper($this->translationHelper, $this->contentTypeServiceMock, $this->fieldTypeServiceMock); + $this->fieldHelper = new FieldHelper($this->translationHelper, $this->fieldTypeServiceMock); } public function testIsFieldEmpty() diff --git a/tests/lib/Limitation/ObjectStateLimitationTypeTest.php b/tests/lib/Limitation/ObjectStateLimitationTypeTest.php index 98a7207bf5..341498cf3a 100644 --- a/tests/lib/Limitation/ObjectStateLimitationTypeTest.php +++ b/tests/lib/Limitation/ObjectStateLimitationTypeTest.php @@ -295,11 +295,13 @@ public function testGetCriterionMultipleValuesFromMultipleGroups() self::assertInstanceOf(LogicalAnd::class, $criterion); self::assertIsArray($criterion->criteria); + self::assertInstanceOf(ObjectStateId::class, $criterion->criteria[0]); self::assertIsArray($criterion->criteria[0]->value); self::assertIsString($criterion->criteria[0]->operator); self::assertEquals(Operator::IN, $criterion->criteria[0]->operator); self::assertEquals([1, 2], $criterion->criteria[0]->value); + self::assertInstanceOf(ObjectStateId::class, $criterion->criteria[1]); self::assertIsArray($criterion->criteria[1]->value); self::assertIsString($criterion->criteria[1]->operator); self::assertEquals(Operator::IN, $criterion->criteria[1]->operator); diff --git a/tests/lib/Persistence/Cache/ContentHandlerTest.php b/tests/lib/Persistence/Cache/ContentHandlerTest.php index dc971c41f8..2ab1b775cd 100644 --- a/tests/lib/Persistence/Cache/ContentHandlerTest.php +++ b/tests/lib/Persistence/Cache/ContentHandlerTest.php @@ -54,7 +54,6 @@ public function providerForUnCachedMethods(): array ['deleteVersion', [2, 1], [['content_version', [2, 1], false]], null, ['c-2-v-1']], ['addRelation', [new RelationCreateStruct(['destinationContentId' => 2, 'sourceContentId' => 4])], [['content', [2], false], ['content', [4], false]], null, ['c-2', 'c-4']], ['removeRelation', [66, APIRelation::COMMON, 2], [['content', [2], false], ['relation', [66], false]], null, ['c-2', 're-66']], - ['loadRelations', [2, 1, 3]], ['loadReverseRelations', [2, 3]], ['publish', [2, 3, new MetadataUpdateStruct()], [['content', [2], false]], null, ['c-2']], [ diff --git a/tests/lib/Persistence/Cache/LocationHandlerTest.php b/tests/lib/Persistence/Cache/LocationHandlerTest.php index 87a68a7836..65290fadb3 100644 --- a/tests/lib/Persistence/Cache/LocationHandlerTest.php +++ b/tests/lib/Persistence/Cache/LocationHandlerTest.php @@ -33,7 +33,6 @@ public function providerForUnCachedMethods(): array return [ ['copySubtree', [12, 45]], ['move', [12, 45], [['location_path', [12], false]], null, ['lp-12']], - ['markSubtreeModified', [12]], ['hide', [12], [['location_path', [12], false]], null, ['lp-12']], ['unHide', [12], [['location_path', [12], false]], null, ['lp-12']], [ diff --git a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php index fedd7615b9..ca0ed86d59 100644 --- a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php +++ b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php @@ -41,11 +41,6 @@ public function testGetName() self::assertEquals(PersistenceLogger::NAME, $this->logger->getName()); } - public function testGetCount() - { - self::assertEquals(0, $this->logger->getCount()); - } - public function testGetCalls() { self::assertEquals([], $this->logger->getCalls()); @@ -61,18 +56,6 @@ public function testLogCall() return $this->logger; } - /** - * @depends testLogCall - * - * @param \Ibexa\Core\Persistence\Cache\PersistenceLogger $logger - */ - public function testGetCountValues($logger) - { - self::assertEquals(4, $logger->getCount()); - - return $logger; - } - /** * @depends testGetCountValues * diff --git a/tests/lib/Persistence/Cache/UserHandlerTest.php b/tests/lib/Persistence/Cache/UserHandlerTest.php index ffac1503ba..7d926db583 100644 --- a/tests/lib/Persistence/Cache/UserHandlerTest.php +++ b/tests/lib/Persistence/Cache/UserHandlerTest.php @@ -151,7 +151,6 @@ public function providerForUnCachedMethods(): array null, ['p-13', 'r-9'], ], - ['loadPoliciesByUserId', [14]], [ 'unassignRole', [14, 9], diff --git a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php index 44a6221750..a79b51c757 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php @@ -39,14 +39,13 @@ public function testInsertBookmark() $id = $this->getGateway()->insertBookmark(new Bookmark([ 'userId' => 14, 'locationId' => 54, - 'name' => 'Lorem ipsum dolor...', ])); $data = $this->loadBookmark($id); self::assertEquals([ 'id' => $id, - 'name' => 'Lorem ipsum dolor...', + 'name' => '', 'node_id' => '54', 'user_id' => '14', ], $data); diff --git a/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php b/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php index 6b0508685c..1b9e0c99f6 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php @@ -38,13 +38,11 @@ protected function setUp(): void public function testCreate() { $createStruct = new CreateStruct([ - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]); $bookmark = new Bookmark([ - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]); @@ -90,7 +88,6 @@ public function testLoadByUserIdAndLocationIdExistingBookmark() ]; $object = new Bookmark([ - 'name' => 'Contact', 'locationId' => $locationId, 'userId' => $userId, ]); @@ -139,13 +136,13 @@ public function testLoadUserBookmarks() $rows = [ [ 'id' => '12', - 'name' => 'Home', + 'name' => '', 'node_id' => '2', 'user_id' => $userId, ], [ 'id' => '75', - 'name' => 'Contact', + 'name' => '', 'node_id' => '54', 'user_id' => $userId, ], @@ -154,13 +151,11 @@ public function testLoadUserBookmarks() $objects = [ new Bookmark([ 'id' => 12, - 'name' => 'Home', 'locationId' => 2, 'userId' => 78, ]), new Bookmark([ 'id' => 75, - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]), diff --git a/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php b/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php index f3b4dcaa86..3e88f1cd1e 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php @@ -29,13 +29,11 @@ protected function setUp(): void public function testCreateBookmarkFromCreateStruct() { $createStruct = new CreateStruct([ - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]); self::assertEquals(new Bookmark([ - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]), $this->mapper->createBookmarkFromCreateStruct($createStruct)); @@ -46,13 +44,13 @@ public function testExtractBookmarksFromRows() $rows = [ [ 'id' => '12', - 'name' => 'Home', + 'name' => '', 'node_id' => '2', 'user_id' => '78', ], [ 'id' => '75', - 'name' => 'Contact', + 'name' => '', 'node_id' => '54', 'user_id' => '87', ], @@ -61,13 +59,11 @@ public function testExtractBookmarksFromRows() $objects = [ new Bookmark([ 'id' => 12, - 'name' => 'Home', 'locationId' => 2, 'userId' => 78, ]), new Bookmark([ 'id' => 75, - 'name' => 'Contact', 'locationId' => 54, 'userId' => 87, ]), diff --git a/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php b/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php index 787fd9567d..b3737f54c7 100644 --- a/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php @@ -860,7 +860,7 @@ public function testLoadRelation(): void ); } - public function testLoadRelations() + public function testLoadRelationList(): void { $handler = $this->getContentHandler(); @@ -868,11 +868,9 @@ public function testLoadRelations() $mapperMock = $this->getMapperMock(); $gatewayMock->expects(self::once()) - ->method('loadRelations') + ->method('listRelations') ->with( - self::equalTo(23), - self::equalTo(null), - self::equalTo(null) + self::equalTo(23) )->will( self::returnValue([42]) ); @@ -880,13 +878,13 @@ public function testLoadRelations() $mapperMock->expects(self::once()) ->method('extractRelationsFromRows') ->with(self::equalTo([42])) - ->will(self::returnValue($this->getRelationFixture())); + ->will(self::returnValue([$this->getRelationFixture()])); - $result = $handler->loadRelations(23); + $result = $handler->loadRelationList(23, 10); self::assertEquals( $result, - $this->getRelationFixture() + [$this->getRelationFixture()] ); } diff --git a/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php index 0d11c7bde9..4ded4b9096 100644 --- a/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php @@ -132,7 +132,6 @@ protected function getContentFixture() $content->versionInfo->contentInfo->alwaysAvailable = true; $content->versionInfo->contentInfo->publicationDate = 123; $content->versionInfo->contentInfo->modificationDate = 456; - $content->versionInfo->contentInfo->isPublished = false; $content->versionInfo->contentInfo->name = 'Content name'; return $content; diff --git a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php index 3dc7d9edb5..df23d9998f 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php @@ -367,28 +367,6 @@ public function testMoveSubtreeAssignmentUpdate() ); } - public function testUpdateSubtreeModificationTime() - { - $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); - $gateway = $this->getLocationGateway(); - $time = time(); - $gateway->updateSubtreeModificationTime('/1/2/69/'); - - $query = $this->getDatabaseConnection()->createQueryBuilder(); - $this->assertQueryResult( - [ - ['/1/'], - ['/1/2/'], - ['/1/2/69/'], - ], - $query - ->select('path_string') - ->from('ezcontentobject_tree') - ->where($query->expr()->gte('modified_subnode', $time)) - ->orderBy('path_string') - ); - } - public function testHideUpdateHidden() { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -664,7 +642,6 @@ public static function getCreateLocationReturnValues() ['remoteId', 'some_id'], ['contentId', '68'], ['parentId', '77'], - ['pathIdentificationString', ''], ['pathString', '/1/2/77/228/'], ['depth', 3], ['sortField', 1], @@ -987,7 +964,6 @@ public static function getConvertNodeAssignmentsLocationValues() ['modified_subnode', time()], ['node_id', '228'], ['parent_node_id', '77'], - ['path_identification_string', null], ['path_string', '/1/2/77/228/'], ['priority', '101'], ['remote_id', 'some_id'], diff --git a/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php b/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php index da42e450cc..b4b66a462c 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php @@ -53,7 +53,6 @@ class MapperTest extends TestCase 'remoteId' => 'dbc2f3c8716c12f32c379dbf0b1cb133', 'contentId' => 75, 'parentId' => 2, - 'pathIdentificationString' => 'solutions', 'pathString' => '/1/2/77/', 'depth' => 2, 'sortField' => 2, @@ -71,7 +70,6 @@ class MapperTest extends TestCase 'hidden' => 0, 'invisible' => 0, 'parentId' => 2, - 'pathIdentificationString' => 'solutions', 'priority' => 0, 'sortField' => 2, 'sortOrder' => 1, diff --git a/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php index bd77914e22..3a4beafc3f 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php @@ -107,11 +107,6 @@ public function testTrashSubtree() ->method('removeLocation') ->with(21); - $this->locationHandler - ->expects(self::once()) - ->method('markSubtreeModified') - ->with(40); - $this->locationGateway ->expects(self::at(5)) ->method('loadTrashByLocation') @@ -178,11 +173,6 @@ public function testTrashSubtreeReturnsNull() ->method('trashLocation') ->with(21); - $this->locationHandler - ->expects(self::once()) - ->method('markSubtreeModified') - ->with(40); - $returnValue = $handler->trashSubtree(20); self::assertNull($returnValue); } @@ -253,12 +243,7 @@ public function testTrashSubtreeUpdatesMainLocation() $this->locationHandler ->expects(self::once()) ->method('changeMainLocation') - ->with(11, 100, 101, 102); - - $this->locationHandler - ->expects(self::once()) - ->method('markSubtreeModified') - ->with(40); + ->with(11, 100); $this->locationGateway ->expects(self::at(6)) diff --git a/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php b/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php index 50dd1c4eca..36a4d82d89 100644 --- a/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php @@ -401,32 +401,6 @@ public function testSetSectionForSubtree() $handler->setSectionForSubtree(69, 3); } - public function testMarkSubtreeModified() - { - $handler = $this->getLocationHandler(); - - $this->locationGateway - ->expects(self::at(0)) - ->method('getBasicNodeData') - ->with(69) - ->will( - self::returnValue( - [ - 'node_id' => 69, - 'path_string' => '/1/2/69/', - 'contentobject_id' => 67, - ] - ) - ); - - $this->locationGateway - ->expects(self::at(1)) - ->method('updateSubtreeModificationTime') - ->with('/1/2/69/'); - - $handler->markSubtreeModified(69); - } - public function testChangeMainLocation() { $handler = $this->getLocationHandler(); @@ -609,7 +583,6 @@ public function testCopySubtree() } $lastContentHandlerIndex = $index * 2 + 1; - $pathStrings = [$destinationData['node_id'] => $destinationData['path_identification_string']]; foreach ($subtreeContentRows as $index => $row) { $mapper = new Mapper(); $createStruct = $mapper->getLocationCreateStruct($row); @@ -624,8 +597,6 @@ public function testCopySubtree() $createStruct->parentId = $index === 0 ? $destinationData['node_id'] : $createStruct->parentId + $offset; $createStruct->invisible = true; $createStruct->mainLocationId = $mainLocationsMap[$index]; - $createStruct->pathIdentificationString = $pathStrings[$createStruct->parentId] . '/' . $row['path_identification_string']; - $pathStrings[$row['node_id'] + $offset] = $createStruct->pathIdentificationString; $handler ->expects(self::at($index)) ->method('create') @@ -638,7 +609,6 @@ public function testCopySubtree() 'contentId' => $row['contentobject_id'], 'hidden' => false, 'invisible' => true, - 'pathIdentificationString' => $createStruct->pathIdentificationString, ] ) ) diff --git a/tests/lib/Persistence/Legacy/Content/_fixtures/extract_content_from_rows_result.php b/tests/lib/Persistence/Legacy/Content/_fixtures/extract_content_from_rows_result.php index 03f9783faa..ccb5c787ae 100644 --- a/tests/lib/Persistence/Legacy/Content/_fixtures/extract_content_from_rows_result.php +++ b/tests/lib/Persistence/Legacy/Content/_fixtures/extract_content_from_rows_result.php @@ -35,7 +35,6 @@ $versionInfo->contentInfo->modificationDate = 1313061404; $versionInfo->contentInfo->publicationDate = 1313047907; $versionInfo->contentInfo->currentVersionNo = 2; -$versionInfo->contentInfo->isPublished = true; $versionInfo->contentInfo->mainLanguageCode = 'eng-US'; $versionInfo->contentInfo->name = 'Something'; $versionInfo->contentInfo->mainLocationId = 228; diff --git a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php index ae0cfc0d8f..4aba1f9964 100644 --- a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php +++ b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php @@ -912,31 +912,6 @@ public function testRemoveUserRoleAssociation() ); } - public function testLoadPoliciesForUser() - { - $this->insertSharedDatabaseFixture(); - $handler = $this->getUserHandler(); - - $policies = $handler->loadPoliciesByUserId(10); // Anonymous user - - // Verify, that we received an array of Policy objects - self::assertTrue( - array_reduce( - array_map( - static function ($policy): bool { - return $policy instanceof Persistence\User\Policy; - }, - $policies - ), - static function ($a, $b): bool { - return $a && $b; - }, - true - ) - ); - self::assertCount(8, $policies); - } - public function testLoadRoleAssignmentsByGroupId() { $this->insertSharedDatabaseFixture(); diff --git a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php index 3f5f8f2766..60d41317d4 100644 --- a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php @@ -60,7 +60,7 @@ public function testLoadContentInfoListDecorator() $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); - $parameters = [['random_value_5ced05ce154173.99718966']]; + $parameters = [[9999]]; $serviceMock->expects(self::once())->method('loadContentInfoList')->with(...$parameters)->willReturn([]); diff --git a/tests/lib/Repository/LocationServiceTest.php b/tests/lib/Repository/LocationServiceTest.php index 2c3b583bf9..443e4020ab 100644 --- a/tests/lib/Repository/LocationServiceTest.php +++ b/tests/lib/Repository/LocationServiceTest.php @@ -11,11 +11,11 @@ use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; -use Ibexa\Core\Repository\Helper\NameSchemaService; use Ibexa\Core\Repository\LocationService; use Ibexa\Core\Repository\Mapper\ContentDomainMapper; use PHPUnit\Framework\TestCase; @@ -31,7 +31,7 @@ protected function setUp(): void $this->createMock(Repository::class), $this->createMock(PersistenceHandler::class), $this->createMock(ContentDomainMapper::class), - $this->createMock(NameSchemaService::class), + $this->createMock(NameSchemaServiceInterface::class), $this->createMock(PermissionCriterionResolver::class), $this->createMock(PermissionResolver::class), $this->createMock(LocationFilteringHandler::class), diff --git a/tests/lib/Repository/Service/Mock/Base.php b/tests/lib/Repository/Service/Mock/Base.php index 7ab15416c9..c8586cf24d 100644 --- a/tests/lib/Repository/Service/Mock/Base.php +++ b/tests/lib/Repository/Service/Mock/Base.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler; use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler; use Ibexa\Contracts\Core\Persistence\Handler; +use Ibexa\Contracts\Core\Persistence\TransactionHandler; use Ibexa\Contracts\Core\Repository\LanguageResolver; use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PasswordHashService; @@ -98,6 +99,8 @@ abstract class Base extends TestCase /** @var \Ibexa\Contracts\Core\Persistence\Filter\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ private $locationFilteringHandlerMock; + private TransactionHandler&MockObject $transactionHandlerMock; + /** * Get Real repository with mocked dependencies. * @@ -115,7 +118,6 @@ protected function getRepository(array $serviceSettings = []) $this->getRelationProcessorMock(), $this->getFieldTypeRegistryMock(), $this->createMock(PasswordHashService::class), - $this->getThumbnailStrategy(), $this->createMock(ProxyDomainMapperFactoryInterface::class), $this->getContentDomainMapperMock(), $this->getContentTypeDomainMapperMock(), @@ -130,6 +132,7 @@ protected function getRepository(array $serviceSettings = []) $this->createMock(PasswordValidatorInterface::class), $this->createMock(ConfigResolverInterface::class), $this->createMock(NameSchemaServiceInterface::class), + $this->getTransactionHandlerMock(), $serviceSettings, ); @@ -311,6 +314,15 @@ protected function getPersistenceMock() return $this->persistenceMock; } + protected function getTransactionHandlerMock(): MockObject&TransactionHandler + { + if (!isset($this->transactionHandlerMock)) { + $this->transactionHandlerMock = $this->createMock(TransactionHandler::class); + } + + return $this->transactionHandlerMock; + } + protected function getRelationProcessorMock() { return $this->createMock(RelationProcessor::class); diff --git a/tests/lib/Repository/Service/Mock/ContentTest.php b/tests/lib/Repository/Service/Mock/ContentTest.php index 4e2333084b..7fab4d7e47 100644 --- a/tests/lib/Repository/Service/Mock/ContentTest.php +++ b/tests/lib/Repository/Service/Mock/ContentTest.php @@ -804,7 +804,6 @@ public function testDeleteContentThrowsUnauthorizedException() ] ); - $persistenceHandlerMock = $this->getPersistenceMockHandler('Handler'); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ $contentHandler = $this->getPersistenceMock()->contentHandler(); @@ -852,9 +851,6 @@ public function testDeleteContent() $urlAliasHandler = $this->getPersistenceMock()->urlAliasHandler(); /** @var \PHPUnit\Framework\MockObject\MockObject $locationHandler */ $locationHandler = $this->getPersistenceMock()->locationHandler(); - /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ - $contentHandler = $this->getPersistenceMock()->contentHandler(); - $contentInfo = $this->createMock(APIContentInfo::class); $contentService->expects(self::once()) @@ -871,7 +867,6 @@ public function testDeleteContent() ] ); - $persistenceHandlerMock = $this->getPersistenceMockHandler('Handler'); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ $contentHandler = $this->getPersistenceMock()->contentHandler(); @@ -949,7 +944,6 @@ public function testDeleteContentWithRollback() ] ); - $persistenceHandlerMock = $this->getPersistenceMockHandler('Handler'); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ $contentHandler = $this->getPersistenceMock()->contentHandler(); diff --git a/tests/lib/Repository/Service/Mock/RepositoryTest.php b/tests/lib/Repository/Service/Mock/RepositoryTest.php index 194bc53f93..f098ed8858 100644 --- a/tests/lib/Repository/Service/Mock/RepositoryTest.php +++ b/tests/lib/Repository/Service/Mock/RepositoryTest.php @@ -22,9 +22,9 @@ class RepositoryTest extends BaseServiceMockTest public function testBeginTransaction() { $mockedRepository = $this->getRepository(); - $persistenceHandlerMock = $this->getPersistenceMock(); + $transactionHandlerMock = $this->getTransactionHandlerMock(); - $persistenceHandlerMock->expects( + $transactionHandlerMock->expects( self::once() )->method( 'beginTransaction' @@ -41,9 +41,9 @@ public function testBeginTransaction() public function testCommit() { $mockedRepository = $this->getRepository(); - $persistenceHandlerMock = $this->getPersistenceMock(); + $transactionHandlerMock = $this->getTransactionHandlerMock(); - $persistenceHandlerMock->expects( + $transactionHandlerMock->expects( self::once() )->method( 'commit' @@ -62,9 +62,9 @@ public function testCommitThrowsRuntimeException() $this->expectException(\RuntimeException::class); $mockedRepository = $this->getRepository(); - $persistenceHandlerMock = $this->getPersistenceMock(); + $transactionHandlerMock = $this->getTransactionHandlerMock(); - $persistenceHandlerMock->expects( + $transactionHandlerMock->expects( self::once() )->method( 'commit' @@ -83,9 +83,9 @@ public function testCommitThrowsRuntimeException() public function testRollback() { $mockedRepository = $this->getRepository(); - $persistenceHandlerMock = $this->getPersistenceMock(); + $transactionHandlerMock = $this->getTransactionHandlerMock(); - $persistenceHandlerMock->expects( + $transactionHandlerMock->expects( self::once() )->method( 'rollback' @@ -104,9 +104,9 @@ public function testRollbackThrowsRuntimeException() $this->expectException(\RuntimeException::class); $mockedRepository = $this->getRepository(); - $persistenceHandlerMock = $this->getPersistenceMock(); + $transactionHandlerMock = $this->getTransactionHandlerMock(); - $persistenceHandlerMock->expects( + $transactionHandlerMock->expects( self::once() )->method( 'rollback' diff --git a/tests/lib/Repository/Service/Mock/UrlAliasTest.php b/tests/lib/Repository/Service/Mock/UrlAliasTest.php index 16f2540508..e8e67f5da9 100644 --- a/tests/lib/Repository/Service/Mock/UrlAliasTest.php +++ b/tests/lib/Repository/Service/Mock/UrlAliasTest.php @@ -14,14 +14,15 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as ApiNotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageResolver; +use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; use Ibexa\Core\Base\Exceptions\ForbiddenException; use Ibexa\Core\Base\Exceptions\NotFoundException; -use Ibexa\Core\Repository\Helper\NameSchemaService; use Ibexa\Core\Repository\LocationService; use Ibexa\Core\Repository\URLAliasService; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * Mock test case for UrlAlias Service. @@ -3391,12 +3392,9 @@ public function testRemoveAliasesThrowsUnauthorizedException() $mockedService->removeAliases($aliasList); } - /** - * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Helper\NameSchemaService - */ - protected function getNameSchemaServiceMock() + protected function getNameSchemaServiceMock(): MockObject&NameSchemaServiceInterface { - return $this->createMock(NameSchemaService::class); + return $this->createMock(NameSchemaServiceInterface::class); } /** diff --git a/tests/lib/Repository/Values/Filter/FilterTest.php b/tests/lib/Repository/Values/Filter/FilterTest.php index d0ab859b4c..33211e186c 100644 --- a/tests/lib/Repository/Values/Filter/FilterTest.php +++ b/tests/lib/Repository/Values/Filter/FilterTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; +use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion; use Ibexa\Contracts\Core\Repository\Values\URL\Query\SortClause as URLQuerySortClause; use function md5; use PHPUnit\Framework\TestCase; @@ -188,7 +189,7 @@ public function testWithSortClause(): Filter */ public function testBuildingComplexFilter( Filter $filter, - ?Criterion $expectedCriterion, + ?Query\CriterionInterface $expectedCriterion, array $expectedSortClauses, int $expectedLimit = 0, int $expectedOffset = 0 @@ -230,6 +231,9 @@ public function getComplexFilterTestData(): iterable new SortClause\Location\Priority(), new SortClause\ContentName(Query::SORT_DESC), ]; + self::assertInstanceOf(FilteringCriterion::class, $criterion->criteria[0]); + self::assertInstanceOf(FilteringCriterion::class, $criterion->criteria[1]); + $filter = new Filter(); $filter ->withCriterion($criterion->criteria[0])