From 58954aba5e3e3bdce7f968071b68c300f9270425 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Wed, 24 Jul 2024 08:44:43 +0200 Subject: [PATCH] Apply Feedback. --- doc/03_Grid.md | 4 ++-- src/Asset/Service/AssetService.php | 2 +- src/DataIndex/Grid/GridSearch.php | 3 ++- src/DataIndex/Grid/GridSearchInterface.php | 4 +++- src/Grid/Service/GridService.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/03_Grid.md b/doc/03_Grid.md index fbca4aacf..5f84d6f8a 100644 --- a/doc/03_Grid.md +++ b/doc/03_Grid.md @@ -18,5 +18,5 @@ A filter is a way to filter the data in the grid. One Property of getting the gr Here you can define `page`, `pageSize` and `includeDescendants`. `page` is the page number of the data you want to get. -`pageSize` is the number of items you want to get. ` -includeDescendants` is a boolean value to include the descendants of the current item. +`pageSize` is the number of items you want to get. +`includeDescendants` is a boolean value to include the descendants of the current item. diff --git a/src/Asset/Service/AssetService.php b/src/Asset/Service/AssetService.php index f30079b6b..3c4724abc 100644 --- a/src/Asset/Service/AssetService.php +++ b/src/Asset/Service/AssetService.php @@ -118,7 +118,7 @@ public function getAssetFolder(int $id): Folder $asset = $this->assetSearchService->getAssetById($id); if (!$asset instanceof Folder) { - throw new NotFoundException('folder', $id); + throw new NotFoundException(ElementTypes::TYPE_FOLDER, $id); } $this->eventDispatcher->dispatch( diff --git a/src/DataIndex/Grid/GridSearch.php b/src/DataIndex/Grid/GridSearch.php index d14d5b2ae..23672f023 100644 --- a/src/DataIndex/Grid/GridSearch.php +++ b/src/DataIndex/Grid/GridSearch.php @@ -21,6 +21,7 @@ use Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchServiceInterface; use Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface; use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; +use Pimcore\Bundle\StudioBackendBundle\Exception\Api\SearchException; use Pimcore\Bundle\StudioBackendBundle\Filter\Service\FilterServiceProviderInterface; use Pimcore\Bundle\StudioBackendBundle\Grid\MappedParameter\GridParameter; use Pimcore\Bundle\StudioBackendBundle\Util\Constants\ElementTypes; @@ -38,7 +39,7 @@ public function __construct( } /** - * @throws NotFoundException + * @throws NotFoundException|SearchException */ public function searchAssets(GridParameter $gridParameter): AssetSearchResult { diff --git a/src/DataIndex/Grid/GridSearchInterface.php b/src/DataIndex/Grid/GridSearchInterface.php index 0b82b6ad1..c52095593 100644 --- a/src/DataIndex/Grid/GridSearchInterface.php +++ b/src/DataIndex/Grid/GridSearchInterface.php @@ -17,6 +17,8 @@ namespace Pimcore\Bundle\StudioBackendBundle\DataIndex\Grid; use Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchResult; +use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; +use Pimcore\Bundle\StudioBackendBundle\Exception\Api\SearchException; use Pimcore\Bundle\StudioBackendBundle\Grid\MappedParameter\GridParameter; /** @@ -25,7 +27,7 @@ interface GridSearchInterface { /** - * @throw NotFoundException + * @throws NotFoundException|SearchException */ public function searchAssets(GridParameter $gridParameter): AssetSearchResult; } diff --git a/src/Grid/Service/GridService.php b/src/Grid/Service/GridService.php index e46d56c16..be30e8658 100644 --- a/src/Grid/Service/GridService.php +++ b/src/Grid/Service/GridService.php @@ -89,7 +89,7 @@ public function getAssetGrid(GridParameter $gridParameter): Collection $data[] = $this->getGridDataForElement( $this->getConfigurationFromArray($gridParameter->getColumns()), $asset, - 'asset' + ElementTypes::TYPE_ASSET ); }