Skip to content

Commit

Permalink
Remove constructor params and fix collection getter
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Apr 12, 2024
1 parent 721a50e commit 4b589c8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/Controller/Api/Assets/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use Pimcore\Bundle\StudioApiBundle\Service\AssetSearchServiceInterface;
use Pimcore\Bundle\StudioApiBundle\Service\Filter\FilterServiceInterface;
use Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\AssetQuery;
use Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\AssetQueryProviderInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
use Symfony\Component\Routing\Attribute\Route;
Expand All @@ -48,7 +47,6 @@ final class CollectionController extends AbstractApiController

public function __construct(
SerializerInterface $serializer,
private readonly AssetQueryProviderInterface $assetQueryProvider,
private readonly AssetSearchServiceInterface $assetSearchService,
private readonly FilterServiceInterface $filterService
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/DataObjects/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getAssets(#[MapQueryString] Collection $collection): JsonRespons

$dataObjectQuery = $this->getDataQuery()
->setPage($collection->getPage())
->setPageSize($collection->getLimit())
->setPageSize($collection->getPageSize())
->setClassDefinitionId('EV');
$result = $this->dataObjectSearchService->searchDataObjects($dataObjectQuery);

Expand Down
36 changes: 36 additions & 0 deletions src/Service/Filter/Loader/TaggedIteratorAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under following license:
* - Pimcore Commercial License (PCL)
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Service\Filter\Loader;

use Pimcore\Bundle\BackendPowerToolsBundle\PreconditionFilter\PreconditionFilterLoaderInterface;
use Pimcore\Bundle\BackendPowerToolsBundle\Provider\PreconditionFilterProvider;
use Pimcore\Bundle\StudioApiBundle\Service\Filter\FilterLoaderInterface;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;

/**
* @internal
*/
final class TaggedIteratorAdapter implements FilterLoaderInterface
{
public function __construct(
#[TaggedIterator('pimcore.studio_api.collection.filter')]
private readonly iterable $taggedServices
) {
}

public function loadFilters(): array
{
return [... $this->taggedServices];
}
}

0 comments on commit 4b589c8

Please sign in to comment.