Skip to content

Commit

Permalink
fix(symfony): use "main" state alias for decoration (#5806)
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka authored Sep 11, 2023
1 parent b9cf499 commit 2dd058a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Bundle/Resources/config/api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@

<service id="api_platform.action.entrypoint" class="ApiPlatform\Action\EntrypointAction" public="true">
<argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
<argument type="service" id="api_platform.state_provider" on-invalid="null" />
<argument type="service" id="api_platform.state_processor" on-invalid="null" />
<argument type="service" id="api_platform.state_provider.main" on-invalid="null" />
<argument type="service" id="api_platform.state_processor.main" on-invalid="null" />
</service>

<service id="api_platform.action.documentation" class="ApiPlatform\Documentation\Action\DocumentationAction" public="true">
Expand All @@ -108,8 +108,8 @@
<argument>%api_platform.description%</argument>
<argument>%api_platform.version%</argument>
<argument type="service" id="api_platform.openapi.factory" on-invalid="null" />
<argument type="service" id="api_platform.state_provider" on-invalid="null" />
<argument type="service" id="api_platform.state_processor" on-invalid="null" />
<argument type="service" id="api_platform.state_provider.main" on-invalid="null" />
<argument type="service" id="api_platform.state_processor.main" on-invalid="null" />
</service>

<service id="api_platform.action.exception" class="ApiPlatform\Action\ExceptionAction" public="true">
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/hydra.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- State -->

<service id="api_platform.hydra.processor.link" class="ApiPlatform\Hydra\State\HydraLinkProcessor" decorates="api_platform.state_processor" decoration-priority="410">
<service id="api_platform.hydra.processor.link" class="ApiPlatform\Hydra\State\HydraLinkProcessor" decorates="api_platform.state_processor.main" decoration-priority="410">
<argument type="service" id="api_platform.hydra.processor.link.inner" />
<argument type="service" id="api_platform.router" />
</service>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/Resources/config/jsonld.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<argument type="service" id="api_platform.jsonld.context_builder" />
<argument type="service" id="api_platform.metadata.resource.name_collection_factory" />
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
<argument type="service" id="api_platform.state_provider" on-invalid="null" />
<argument type="service" id="api_platform.state_processor" on-invalid="null" />
<argument type="service" id="api_platform.state_provider.main" on-invalid="null" />
<argument type="service" id="api_platform.state_processor.main" on-invalid="null" />
<argument type="service" id="api_platform.serializer" on-invalid="null" />
</service>
</services>
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/mercure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<services>
<!-- Event listener -->

<service id="api_platform.mercure.processor.add_link_header" class="ApiPlatform\Symfony\State\MercureLinkProcessor" decorates="api_platform.state_processor" decoration-priority="400">
<service id="api_platform.mercure.processor.add_link_header" class="ApiPlatform\Symfony\State\MercureLinkProcessor" decorates="api_platform.state_processor.main" decoration-priority="400">
<argument type="service" id="api_platform.mercure.processor.add_link_header.inner" />
<argument type="service" id="Symfony\Component\Mercure\Discovery" on-invalid="ignore"/>
</service>
Expand Down
14 changes: 8 additions & 6 deletions src/Symfony/Bundle/Resources/config/state.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@
</service>
<service id="api_platform.state_provider" alias="api_platform.state_provider.locator" />

<service id="api_platform.state_provider.main" alias="api_platform.state_provider.locator" />

<service id="api_platform.state_processor.locator" class="ApiPlatform\State\CallableProcessor">
<argument type="tagged_locator" tag="api_platform.state_processor" index-by="key" />
</service>

<service id="api_platform.state_provider.content_negotiation" class="ApiPlatform\State\Provider\ContentNegotiationProvider" decorates="api_platform.state_provider" decoration-priority="100">
<service id="api_platform.state_provider.content_negotiation" class="ApiPlatform\State\Provider\ContentNegotiationProvider" decorates="api_platform.state_provider.main" decoration-priority="100">
<argument type="service" id="api_platform.state_provider.content_negotiation.inner" />
<argument type="service" id="api_platform.negotiator" />
<argument>%api_platform.formats%</argument>
<argument>%api_platform.error_formats%</argument>
</service>

<service id="api_platform.state_provider.read" class="ApiPlatform\State\Provider\ReadProvider" decorates="api_platform.state_provider" decoration-priority="500">
<service id="api_platform.state_provider.read" class="ApiPlatform\State\Provider\ReadProvider" decorates="api_platform.state_provider.main" decoration-priority="500">
<argument type="service" id="api_platform.state_provider.read.inner" />
<argument type="service" id="api_platform.serializer.context_builder" />
</service>

<service id="api_platform.state_provider.deserialize" class="ApiPlatform\State\Provider\DeserializeProvider" decorates="api_platform.state_provider" decoration-priority="300">
<service id="api_platform.state_provider.deserialize" class="ApiPlatform\State\Provider\DeserializeProvider" decorates="api_platform.state_provider.main" decoration-priority="300">
<argument type="service" id="api_platform.state_provider.deserialize.inner" />
<argument type="service" id="api_platform.serializer" />
<argument type="service" id="api_platform.serializer.context_builder" />
Expand All @@ -36,19 +38,19 @@
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="api_platform.resource_class_resolver" />
</service>
<service id="api_platform.state_processor" alias="api_platform.state_processor.respond" />
<service id="api_platform.state_processor.main" alias="api_platform.state_processor.respond" />

<service id="api_platform.state_processor.add_link_header" class="ApiPlatform\State\Processor\AddLinkHeaderProcessor" decorates="api_platform.state_processor.respond">
<argument type="service" id="api_platform.state_processor.add_link_header.inner" />
</service>

<service id="api_platform.state_processor.serialize" class="ApiPlatform\State\Processor\SerializeProcessor" decorates="api_platform.state_processor" decoration-priority="200">
<service id="api_platform.state_processor.serialize" class="ApiPlatform\State\Processor\SerializeProcessor" decorates="api_platform.state_processor.main" decoration-priority="200">
<argument type="service" id="api_platform.state_processor.serialize.inner" />
<argument type="service" id="api_platform.serializer" />
<argument type="service" id="api_platform.serializer.context_builder" />
</service>

<service id="api_platform.state_processor.write" class="ApiPlatform\State\Processor\WriteProcessor" decorates="api_platform.state_processor" decoration-priority="100">
<service id="api_platform.state_processor.write" class="ApiPlatform\State\Processor\WriteProcessor" decorates="api_platform.state_processor.main" decoration-priority="100">
<argument type="service" id="api_platform.state_processor.write.inner" />
<argument type="service" id="api_platform.state_processor.locator" />
</service>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/Resources/config/symfony/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<services>
<service id="api_platform.symfony.main_controller" class="ApiPlatform\Symfony\Controller\MainController" public="true">
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
<argument type="service" id="api_platform.state_provider" />
<argument type="service" id="api_platform.state_processor" />
<argument type="service" id="api_platform.state_provider.main" />
<argument type="service" id="api_platform.state_processor.main" />
<argument type="service" id="api_platform.uri_variables.converter" on-invalid="ignore" />
<argument type="service" id="logger" on-invalid="ignore" />
</service>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/Resources/config/symfony/validator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<argument type="service" id="api_platform.filter_locator" />
</service>

<service id="api_platform.state_provider.query_parameter_validate" class="ApiPlatform\Symfony\Validator\State\QueryParameterValidateProvider" decorates="api_platform.state_provider" decoration-priority="200">
<service id="api_platform.state_provider.query_parameter_validate" class="ApiPlatform\Symfony\Validator\State\QueryParameterValidateProvider" decorates="api_platform.state_provider.main" decoration-priority="200">
<argument type="service" id="api_platform.state_provider.query_parameter_validate.inner" />
<argument type="service" id="api_platform.validator.query_parameter_validator" />
</service>

<service id="api_platform.state_provider.validate" class="ApiPlatform\Symfony\Validator\State\ValidateProvider" decorates="api_platform.state_provider" decoration-priority="200">
<service id="api_platform.state_provider.validate" class="ApiPlatform\Symfony\Validator\State\ValidateProvider" decorates="api_platform.state_provider.main" decoration-priority="200">
<argument type="service" id="api_platform.state_provider.validate.inner" />
<argument type="service" id="api_platform.validator" />
</service>
Expand Down

0 comments on commit 2dd058a

Please sign in to comment.