diff --git a/doc/01_Installation/02_Upgrade.md b/doc/01_Installation/02_Upgrade.md index b5250b1c..0f67a07c 100644 --- a/doc/01_Installation/02_Upgrade.md +++ b/doc/01_Installation/02_Upgrade.md @@ -6,3 +6,24 @@ Following steps are necessary during updating to newer versions. - Execute the following command to reindex all elements to be able to use all new features: ```bin/console generic-data-index:update:index``` + +## Upgrade to 2.0.0 + +### BC-Breaks + +#### Interface changes +- Added `PermissionTypes $permissionType` parameter with default type `PermissionTypes::LIST` to +- `AssetSearchServiceInterface::search` method +- `DocumentSearchServiceInterface::search` method +- `DataObjectSearchServiceInterface::search` method +- `ElementSearchServiceInterface::search` method +- Search services `byId` methods now return elements based on the `PermissionTypes::VIEW` permission +- Added type specific interfaces for searches to avoid mixing up different search types in search services + - `AssetSearch` now implements `AssetSearchInterface` + - `DocumentSearch` now implements `DocumentSearchInterface` + - `ElementSearch` now implements `ElementSearchInterface` +- Search services now require the specific search type for the search + - `AssetSearchServiceInterface::search` now requires a `AssetSearchInterface` + - `DocumentSearchServiceInterface::search` now requires a `DocumentSearchInterface` + - `ElementSearchServiceInterface::search` now requires a `ElementSearchInterface` +- `SearchProviderInterface` now returns type specific search interfaces \ No newline at end of file diff --git a/src/Model/Search/Asset/AssetSearch.php b/src/Model/Search/Asset/AssetSearch.php index d38c1d13..af5b4b45 100644 --- a/src/Model/Search/Asset/AssetSearch.php +++ b/src/Model/Search/Asset/AssetSearch.php @@ -18,6 +18,6 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\BaseSearch; -final class AssetSearch extends BaseSearch +final class AssetSearch extends BaseSearch implements AssetSearchInterface { } diff --git a/src/Model/Search/Asset/AssetSearchInterface.php b/src/Model/Search/Asset/AssetSearchInterface.php new file mode 100644 index 00000000..6517cb84 --- /dev/null +++ b/src/Model/Search/Asset/AssetSearchInterface.php @@ -0,0 +1,23 @@ +searchHelper->addSearchRestrictions( diff --git a/src/Service/Search/SearchService/Asset/AssetSearchServiceInterface.php b/src/Service/Search/SearchService/Asset/AssetSearchServiceInterface.php index 6a08143f..65c6f5f9 100644 --- a/src/Service/Search/SearchService/Asset/AssetSearchServiceInterface.php +++ b/src/Service/Search/SearchService/Asset/AssetSearchServiceInterface.php @@ -18,9 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\PermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Exception\AssetSearchException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\AssetSearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\AssetSearchResultItem; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; + use Pimcore\Model\User; interface AssetSearchServiceInterface @@ -29,7 +30,7 @@ interface AssetSearchServiceInterface * @throws AssetSearchException */ public function search( - SearchInterface $assetSearch, + AssetSearchInterface $assetSearch, PermissionTypes $permissionType = PermissionTypes::LIST ): AssetSearchResult; diff --git a/src/Service/Search/SearchService/Document/DocumentSearchService.php b/src/Service/Search/SearchService/Document/DocumentSearchService.php index 661423b1..473db3f2 100644 --- a/src/Service/Search/SearchService/Document/DocumentSearchService.php +++ b/src/Service/Search/SearchService/Document/DocumentSearchService.php @@ -20,9 +20,9 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\PermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\UserPermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Exception\DocumentSearchException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\DocumentSearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\DocumentSearchResultItem; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Basic\IdFilter; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\DocumentWorkspace; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\Pagination\PaginationInfoServiceInterface; @@ -49,7 +49,7 @@ public function __construct( * @throws DocumentSearchException */ public function search( - SearchInterface $documentSearch, + DocumentSearchInterface $documentSearch, PermissionTypes $permissionType = PermissionTypes::LIST ): DocumentSearchResult { $documentSearch = $this->searchHelper->addSearchRestrictions( diff --git a/src/Service/Search/SearchService/Document/DocumentSearchServiceInterface.php b/src/Service/Search/SearchService/Document/DocumentSearchServiceInterface.php index 73b9dd24..4bb6f0f3 100644 --- a/src/Service/Search/SearchService/Document/DocumentSearchServiceInterface.php +++ b/src/Service/Search/SearchService/Document/DocumentSearchServiceInterface.php @@ -18,9 +18,9 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\PermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Exception\DocumentSearchException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\DocumentSearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\DocumentSearchResultItem; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Model\User; interface DocumentSearchServiceInterface @@ -29,7 +29,7 @@ interface DocumentSearchServiceInterface * @throws DocumentSearchException */ public function search( - SearchInterface $documentSearch, + DocumentSearchInterface $documentSearch, PermissionTypes $permissionType = PermissionTypes::LIST ): DocumentSearchResult; diff --git a/src/Service/Search/SearchService/Element/ElementSearchService.php b/src/Service/Search/SearchService/Element/ElementSearchService.php index c38c6814..4e4c5720 100644 --- a/src/Service/Search/SearchService/Element/ElementSearchService.php +++ b/src/Service/Search/SearchService/Element/ElementSearchService.php @@ -20,9 +20,9 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\PermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ElementType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\ElementSearchException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\ElementSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\SearchResult\ElementSearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\ElementSearchResultItemInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\Pagination\PaginationInfoServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\Asset\AssetSearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\DataObject\DataObjectSearchServiceInterface; @@ -46,7 +46,7 @@ public function __construct( } public function search( - SearchInterface $elementSearch, + ElementSearchInterface $elementSearch, PermissionTypes $permissionType = PermissionTypes::LIST ): ElementSearchResult { $elementSearch = $this->searchHelper->addSearchRestrictions($elementSearch, $permissionType); diff --git a/src/Service/Search/SearchService/Element/ElementSearchServiceInterface.php b/src/Service/Search/SearchService/Element/ElementSearchServiceInterface.php index 7c3cbb2e..b418a0ff 100644 --- a/src/Service/Search/SearchService/Element/ElementSearchServiceInterface.php +++ b/src/Service/Search/SearchService/Element/ElementSearchServiceInterface.php @@ -19,9 +19,9 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\PermissionTypes; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ElementType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\ElementSearchException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\ElementSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\SearchResult\ElementSearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\ElementSearchResultItemInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Model\User; interface ElementSearchServiceInterface @@ -30,7 +30,7 @@ interface ElementSearchServiceInterface * @throws ElementSearchException */ public function search( - SearchInterface $elementSearch, + ElementSearchInterface $elementSearch, PermissionTypes $permissionType = PermissionTypes::LIST ): ElementSearchResult; diff --git a/src/Service/Search/SearchService/SearchProvider.php b/src/Service/Search/SearchService/SearchProvider.php index dad1909f..cac0127a 100644 --- a/src/Service/Search/SearchService/SearchProvider.php +++ b/src/Service/Search/SearchService/SearchProvider.php @@ -17,18 +17,20 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearch; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearch; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\ElementSearch; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\ElementSearchInterface; /** * @internal */ final class SearchProvider implements SearchProviderInterface { - public function createAssetSearch(): SearchInterface + public function createAssetSearch(): AssetSearchInterface { return new AssetSearch(); } @@ -38,12 +40,12 @@ public function createDataObjectSearch(): DataObjectSearchInterface return new DataObjectSearch(); } - public function createDocumentSearch(): SearchInterface + public function createDocumentSearch(): DocumentSearchInterface { return new DocumentSearch(); } - public function createElementSearch(): SearchInterface + public function createElementSearch(): ElementSearchInterface { return new ElementSearch(); } diff --git a/src/Service/Search/SearchService/SearchProviderInterface.php b/src/Service/Search/SearchService/SearchProviderInterface.php index 67257802..7fcfc35c 100644 --- a/src/Service/Search/SearchService/SearchProviderInterface.php +++ b/src/Service/Search/SearchService/SearchProviderInterface.php @@ -16,16 +16,18 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearchInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Element\ElementSearchInterface; interface SearchProviderInterface { - public function createAssetSearch(): SearchInterface; + public function createAssetSearch(): AssetSearchInterface; public function createDataObjectSearch(): DataObjectSearchInterface; - public function createDocumentSearch(): SearchInterface; + public function createDocumentSearch(): DocumentSearchInterface; - public function createElementSearch(): SearchInterface; + public function createElementSearch(): ElementSearchInterface; }