core
core copied to clipboard
Broken usage of symfony parameters as FQCN in Resource definition
API Platform version(s) affected: 2.7.0
Description
When a new resource is defined with a container parameter instead of the FQCN with a new metadata system, API Platform breaks, while it was possible to do on previous versions and it is still possible in 2.7.0 with old system.
How to reproduce
- Turn off legacy metadata system
# config/packages/api_platform.yaml
api_platform:
metadata_backward_compatibility_layer: false
- Try to use parameter instead of FQCN
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="%sylius.model.address.class%" shortName="Address">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection" name="shop_get" uriTemplate="/shop/addresses" />
</operations>
</resource>
</resources>
Possible Solution
Additional Context
The class resolver trait is called before XmlPropertyExtractor resolves parameters.