Adding a property to a collection query response #6326
Unanswered
PaulCombal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I would like to add the total number of entities, regardless of the filters, to the reponse of a collection query (ex: GET /products).
This documentation walks us through the steps to add a new key to an entity result, but how about a collection?
Using the same code than the above documentation (slightly updated for Symfony 7), I tried:
But it gives me:
As soon as I use
->normalize
on the decorated Normalizer.I must admit I don't exactly know what I'm doing.
Is there any way to achieve this properly?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions