Welcome Guest, Not a member yet? Register   Sign In
Serializing Doctrine objects to proper JSON content type using ResponseTrait
#2

Well, I think I get a workaround.

Using Serializer.toArray(); instead of Serializer.serialize(); will do the trick.
       

PHP Code:
$res $serializer->toArray(getEmployeeRepo()->findAll());
return 
$this->respond($res); //application/json is returned 
Reply


Messages In This Thread
RE: JSON content type is missing when using respond - by b126 - 06-21-2022, 07:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB