I am currently building an API and it is a requirement to have the option to get the data in a CSV format. I want this to work in the same way as it works for 'xml'. By this i mean i need to be able to add '.csv' to the end of the URL and this would then return the results in a CSV format.
currently if i go to /entity/all.xml
the serializer will set the format to xml
I cant seem to find where symfony is extracting this from the URL
So my question is if i go to /entity/all.csv
how to i extract the csv from the url to set the format? How does the current serializer do it?
I understand that after this i will need to write the code to actually serialize the data but I'm struggling to work out how this part of the process will work.
I will apologize in advance for asking quite a vague question but Ive been stuck on this for a while now and no search has been able to help me(doesn't help that i don't really know how to word this in a search)
I have tried stepping though the code to see if i can find where its done but i cant seem to spot it plus there is quite a lot of code to step through :/