Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
bb343ddc
Commit
bb343ddc
authored
Jul 25, 2018
by
Mat
Browse files
permettre le retour des résultats même si aucun groupe n'est définit
parent
eccad323
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/APIBundle/Controller/MasterAPIController.php
View file @
bb343ddc
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment