Reputation: 1569
With Api-Platform, exposing Doctrine Entities is quite easy and works very well but I don't see how to create custom entrypoint without entities just to call an external service and get its data or do complex treatments
I saw this post (API Platform - Which approach should I use for creating custom operation without entity) but I don't want to create a POST method just to insert my logic in a data persister.
If i just want to create one entrypoint /getMyCustomData
with the GET
method and without passing any parameter, what should I do?
I looked at swagger decorators but if I understand, it works on an existing entity.
Upvotes: 2
Views: 6700
Reputation: 94
you can create just a normal controller in Symfony.
/**
* @Route("/getMyCustomData", methods={"GET"}, name="my_api_custom_data")
* @param Request $request
* @return Response
*/
public function getMyCustomDataAction(Request $request): Response
{
/** your code **/
}
Upvotes: 2