Commit bb343ddc authored by Mat's avatar Mat

permettre le retour des résultats même si aucun groupe n'est définit

parent eccad323
......@@ -16,11 +16,14 @@ abstract class MasterAPIController extends MasterController
* @param array $groups
* @return JsonResponse
*/
protected function api($data, $status = 200, $groups = array())
protected function api($data, $status = 200, $groups = null)
{
$serializer = $this->get('jms_serializer');
$serialized = $serializer->serialize($data, 'json',
SerializationContext::create()->setGroups($groups));
$serialized = $serializer->serialize(
$data,
'json',
$groups !== null ? SerializationContext::create()->setGroups($groups) : null
);
return new JsonResponse($serialized, $status, array(), true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment