Skip to content

Commit

Permalink
[Grid] [Asset] List configuration use collection to match with schema (
Browse files Browse the repository at this point in the history
…#495)

* Move response list into collection.

* Apply php-cs-fixer changes

---------

Co-authored-by: martineiber <martineiber@users.noreply.github.com>
  • Loading branch information
martineiber and martineiber authored Oct 16, 2024
1 parent 8674e3a commit 3a907dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/Grid/Service/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use Pimcore\Bundle\StudioBackendBundle\Grid\Hydrator\DetailedConfigurationHydratorInterface;
use Pimcore\Bundle\StudioBackendBundle\Grid\Repository\ConfigurationRepositoryInterface;
use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\ColumnConfiguration;
use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\Configuration;
use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\DetailedConfiguration;
use Pimcore\Bundle\StudioBackendBundle\Response\Collection;
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use function count;
Expand Down Expand Up @@ -82,10 +82,7 @@ public function getDefaultAssetGridConfiguration(): DetailedConfiguration
return $detailedConfiguration;
}

/**
* @return Configuration[]
*/
public function getGridConfigurationsForFolder(int $folderId): array
public function getGridConfigurationsForFolder(int $folderId): Collection
{
$configurations = $this->configurationRepository->getByAssetFolderId($folderId);

Expand All @@ -104,7 +101,7 @@ public function getGridConfigurationsForFolder(int $folderId): array
}
}

return $filteredConfigurations;
return new Collection(count($filteredConfigurations), $filteredConfigurations);
}

public function getAssetGridConfiguration(?int $configurationId, int $folderId): DetailedConfiguration
Expand Down
7 changes: 2 additions & 5 deletions src/Grid/Service/ConfigurationServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

namespace Pimcore\Bundle\StudioBackendBundle\Grid\Service;

use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\Configuration;
use Pimcore\Bundle\StudioBackendBundle\Grid\Schema\DetailedConfiguration;
use Pimcore\Bundle\StudioBackendBundle\Response\Collection;

/**
* @internal
Expand All @@ -28,8 +28,5 @@ public function getDefaultAssetGridConfiguration(): DetailedConfiguration;

public function getAssetGridConfiguration(?int $configurationId, int $folderId): DetailedConfiguration;

/**
* @return Configuration[]
*/
public function getGridConfigurationsForFolder(int $folderId): array;
public function getGridConfigurationsForFolder(int $folderId): Collection;
}

0 comments on commit 3a907dd

Please sign in to comment.