Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Apr 24, 2024
1 parent 322c625 commit d96f577
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Api/Assets/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class CollectionController extends AbstractApiController
public function __construct(
SerializerInterface $serializer,
private readonly AssetSearchServiceInterface $assetSearchService,
private readonly FilterServiceProviderInterface $filterServiceFactory
private readonly FilterServiceProviderInterface $filterServiceProvider
) {
parent::__construct($serializer);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public function __construct(
#[UnprocessableContentResponse]
public function getAssets(#[MapQueryString] ElementParameters $parameters): JsonResponse
{
$filterService = $this->filterServiceFactory->create(OpenSearchFilterInterface::SERVICE_TYPE);
$filterService = $this->filterServiceProvider->create(OpenSearchFilterInterface::SERVICE_TYPE);

$assetQuery = $filterService->applyFilters(
$parameters,
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/DataObjects/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class CollectionController extends AbstractApiController
public function __construct(
SerializerInterface $serializer,
private readonly DataObjectSearchServiceInterface $dataObjectSearchService,
private readonly FilterServiceProviderInterface $filterServiceFactory
private readonly FilterServiceProviderInterface $filterServiceProvider
) {
parent::__construct($serializer);
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public function __construct(
#[UnprocessableContentResponse]
public function getDataObjects(#[MapQueryString] DataObjectParameters $parameters): JsonResponse
{
$filterService = $this->filterServiceFactory->create(OpenSearchFilterInterface::SERVICE_TYPE);
$filterService = $this->filterServiceProvider->create(OpenSearchFilterInterface::SERVICE_TYPE);

$dataObjectQuery = $filterService->applyFilters($parameters, 'dataObject');

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/AbstractApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

use Symfony\Component\HttpKernel\Exception\HttpException;

abstract class AbstractApiException extends HttpException implements ApiExceptionInterface
abstract class AbstractApiException extends HttpException
{
}
27 changes: 0 additions & 27 deletions src/Exception/ApiExceptionInterface.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Request/Query/Filter/ElementParametersInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @internal
*/
interface ElementParametersInterface
interface ElementParametersInterface extends CollectionParametersInterface
{
public function getPage(): int;

Expand Down
2 changes: 1 addition & 1 deletion src/Security/Voter/AuthorizationVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

use Pimcore\Bundle\StudioApiBundle\Exception\NoRequestException;
use Pimcore\Bundle\StudioApiBundle\Exception\NotAuthorizedException;
use Pimcore\Bundle\StudioApiBundle\Security\Trait\RequestTrait;
use Pimcore\Bundle\StudioApiBundle\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioApiBundle\Util\Traits\RequestTrait;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
Expand Down
4 changes: 2 additions & 2 deletions src/Security/Voter/PublicAuthorizationVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use Pimcore\Bundle\StudioApiBundle\Exception\NonPublicTranslationException;
use Pimcore\Bundle\StudioApiBundle\Exception\NoRequestException;
use Pimcore\Bundle\StudioApiBundle\Exception\NotAuthorizedException;
use Pimcore\Bundle\StudioApiBundle\Security\Trait\PublicTranslationTrait;
use Pimcore\Bundle\StudioApiBundle\Security\Trait\RequestTrait;
use Pimcore\Bundle\StudioApiBundle\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioApiBundle\Util\Traits\PublicTranslationTrait;
use Pimcore\Bundle\StudioApiBundle\Util\Traits\RequestTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
Expand Down
4 changes: 2 additions & 2 deletions src/Util/Traits/PaginatedResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ trait PaginatedResponseTrait

protected function getPaginatedCollection(
SerializerInterface $serializer,
array $data,
array $items,
int $totalItems = 0
): JsonResponse {
$serialized = $serializer->serialize(new Collection($totalItems, $data), 'json');
$serialized = $serializer->serialize(new Collection($totalItems, $items), 'json');

return new JsonResponse($serialized, 200, [self::HEADER_TOTAL_ITEMS => $totalItems], true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Security\Trait;
namespace Pimcore\Bundle\StudioApiBundle\Util\Traits;

use Pimcore\Bundle\StudioApiBundle\Exception\NonPublicTranslationException;
use Pimcore\Bundle\StudioApiBundle\Util\Constants\PublicTranslations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Security\Trait;
namespace Pimcore\Bundle\StudioApiBundle\Util\Traits;

use Pimcore\Bundle\StudioApiBundle\Exception\NoRequestException;
use Pimcore\Bundle\StudioApiBundle\Exception\NotAuthorizedException;
Expand Down

0 comments on commit d96f577

Please sign in to comment.