-
Hello Our How to link doctrine resource with API resource not mapped with doctrine ? We understood that the operation's But we still have some doubts. Without create provider for each, how to link doctrine resource with API resource not mapped with doctrine ? Thank you for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, Indeed, You can find an example with the proposed component at: https://github.com/soyuka/api-platform-doctrine-mapper/blob/main/src/State/BookProvider.php#L14. At some point I'd like this to be in the Now the last thing you need is to use your Provider on every resource or entity/resource tuple. To do so, use a Metadata Factory, like the one that works on doctrine entities inside the API Platform code: |
Beta Was this translation helpful? Give feedback.
Hi,
Indeed,
stateOptions
orextraProperties
are ways to extend our metadata to your liking.We do this a lot when creating APIs, as it's very useful (for example to avoid serialization groups). For this to be automatic, we either do the mapping by hand or use a mapper (proposal for a new Symfony component: symfony/symfony#51741), check also the Symfony casts on the subject (also uses a micro-mapper).
You can find an example with the proposed component at: https://github.com/soyuka/api-platform-doctrine-mapper/blob/main/src/State/BookProvider.php#L14. At some point I'd like this to be in the
core
.Now the last thing you need is to use your Provider on every resource or entity/resource tupl…