config.yml:
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener:
default_priorities: [json, xml]
view:
view_response_listener: 'force'
sensio_framework_extra:
view: { annotations: false }
router: { annotations: true }
annotated controller:
/**
* @Rest\View(statusCode=204)
* @param \Symfony\Component\HttpFoundation\Request $request
*/
public function signUpAction(Request $request)
{
return $this->get('%%%.response_generator')->generateResponse(array('test'), true, 'test');
// returns a simple Object with some public properties
}
If I access the route with .json
format it returns:
{"status":1,"message":"test","data":["test"]}
But it won't change the status code to the one from annotation.
Also without a specified format, it doesn't fallback to the default .json
format, it still searches for a template.