fix: passing class as parameter in XML ApiResource's definition #6659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Sylius, where we use API Platform, it is important for us to be able to extend entities and because of this we would like to pass the class as a parameter, which is not possible at the moment due to an error:
This happens because in the XmlResourceExtractor, the key
class
is set in the ApiResource metadata with a value that does not point to a specific class, but is a parameter key. This is not done in the YamlResourceExtractor, so in order to make the both extractors consistent with each other, I remove the setting of this wrong value. An alternative would be to set the already resolved class via theresolve
metadata, but I don't think this is needed because the corresponding class is set as a key in the resources array.