Skip to content

Commit

Permalink
fix(serializer): remove serializer context builder interface
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Sep 20, 2024
1 parent 96375d0 commit 72a0b66
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 37 deletions.
3 changes: 1 addition & 2 deletions src/OpenApi/Serializer/SerializerContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@

namespace ApiPlatform\OpenApi\Serializer;

use ApiPlatform\Serializer\SerializerContextBuilderInterface as LegacySerializerContextBuilderInterface;
use ApiPlatform\State\SerializerContextBuilderInterface;
use Symfony\Component\HttpFoundation\Request;

/**
* @internal
*/
final class SerializerContextBuilder implements SerializerContextBuilderInterface, LegacySerializerContextBuilderInterface
final class SerializerContextBuilder implements SerializerContextBuilderInterface
{
public function __construct(private readonly SerializerContextBuilderInterface $decorated)
{
Expand Down
1 change: 1 addition & 0 deletions src/Serializer/SerializerContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use ApiPlatform\Metadata\Exception\RuntimeException;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Metadata\Util\AttributesExtractor;
use ApiPlatform\State\SerializerContextBuilderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
Expand Down
27 changes: 0 additions & 27 deletions src/Serializer/SerializerContextBuilderInterface.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Serializer/SerializerFilterContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Metadata\Util\AttributesExtractor;
use ApiPlatform\Serializer\Filter\FilterInterface;
use ApiPlatform\State\SerializerContextBuilderInterface as StateSerializerContextBuilderInterface;
use ApiPlatform\State\SerializerContextBuilderInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -28,7 +28,7 @@
*/
final class SerializerFilterContextBuilder implements SerializerContextBuilderInterface
{
public function __construct(private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ContainerInterface $filterLocator, private readonly SerializerContextBuilderInterface|StateSerializerContextBuilderInterface $decorated)
public function __construct(private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ContainerInterface $filterLocator, private readonly SerializerContextBuilderInterface $decorated)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Serializer\Filter\FilterInterface as SerializerFilterInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Serializer\SerializerFilterContextBuilder;
use ApiPlatform\Serializer\Tests\Fixtures\ApiResource\DummyGroup;
use ApiPlatform\State\SerializerContextBuilderInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
Expand Down
3 changes: 1 addition & 2 deletions src/State/Provider/DeserializeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use ApiPlatform\Metadata\HttpOperation;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\Serializer\SerializerContextBuilderInterface as LegacySerializerContextBuilderInterface;
use ApiPlatform\State\ProviderInterface;
use ApiPlatform\State\SerializerContextBuilderInterface;
use ApiPlatform\Validator\Exception\ValidationException;
Expand All @@ -36,7 +35,7 @@ final class DeserializeProvider implements ProviderInterface
public function __construct(
private readonly ?ProviderInterface $decorated,
private readonly SerializerInterface $serializer,
private readonly LegacySerializerContextBuilderInterface|SerializerContextBuilderInterface $serializerContextBuilder,
private readonly SerializerContextBuilderInterface $serializerContextBuilder,
private ?TranslatorInterface $translator = null,
) {
if (null === $this->translator) {
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Bundle/Resources/config/api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<argument type="service" id="api_platform.filter_locator" />
<tag name="api_platform.parameter_provider" key="api_platform.serializer.filter_parameter_provider" priority="-895" />
</service>
<service id="ApiPlatform\Serializer\SerializerContextBuilderInterface" alias="api_platform.serializer.context_builder" />
<service id="ApiPlatform\State\SerializerContextBuilderInterface" alias="api_platform.serializer.context_builder" />

<service id="api_platform.serializer.context_builder.filter" class="ApiPlatform\Serializer\SerializerFilterContextBuilder" decorates="api_platform.serializer.context_builder" public="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
use ApiPlatform\Metadata\UrlGeneratorInterface;
use ApiPlatform\Serializer\Filter\GroupFilter;
use ApiPlatform\Serializer\Filter\PropertyFilter;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\State\Pagination\Pagination;
use ApiPlatform\State\Pagination\PaginationOptions;
use ApiPlatform\State\SerializerContextBuilderInterface;
use ApiPlatform\Symfony\Action\NotFoundAction;
use ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension;
use ApiPlatform\Tests\Fixtures\TestBundle\TestBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use ApiPlatform\Metadata\Put;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\State\SerializerContextBuilderInterface;
use ApiPlatform\Symfony\Bundle\ArgumentResolver\PayloadArgumentResolver;
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\ResourceImplementation;
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\ResourceInterface;
Expand Down

0 comments on commit 72a0b66

Please sign in to comment.