How to disable IRI generation for API Resource when normalizing #5875
-
Hey, I have encountered following problem when normalizing data in my Symfony app where I use API Platform as bundle. I have 'File' entity registered as API resource. When invoking follwing code:
I get an error: 'Unable to generate an IRI for the item of type "App\Entity\File"'. In general it happens when I want to normalize API resource that is not persisted yet and does not have id issigned. Thank you for your response in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
By not using API Platform but a controller ? If you really want to you can override the AddLinkProcessor or even delete any Link header before the response but there's no configuration for that yet.
By not using API Platform but a controller ?
It shouldn't. |
Beta Was this translation helpful? Give feedback.
-
I have exactly the same issue @andersmateusz Actually, when I try to normalize/denormalize any of my Entities, the ApiPlatform normalizers are called and this is not my desired intention. |
Beta Was this translation helpful? Give feedback.
genId: false
or custom normalizerBy not using API Platform but a controller ? If you really want to you can override the AddLinkProcessor or even delete any Link header before the response but there's no configuration for that yet.
By not using API Platform but a controller ?
It shouldn't.