You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
namespace PM\ApiBundle\Controller;
...
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\View\View;
class ArticlesController extends FOSRestController
{
/**
* @ApiDoc(
* section="articles",
* resource=true,
* description="Get articles published"
* )
* @Rest\View(serializerGroups={"article"})
* @Rest\Get("/articles")
*/
public function getArticlesAction(Request $request)
{
$articles = $this->getDoctrine()
->getManager()
->getRepository('PMPlatformBundle:Article')
->findAllDateDesc();
/* @var $articles Article[] */
return $articles;
}
Then in my Article entity I added this annotation @groups({"article"}) with the right use statement.
Whit default serializer I get :
[
[],
[]
]
Whit JMS serializer (bundle) I get :
{
"0": {},
"1": {}
}
(I have two articles in db)
it seems like the "article" group is not recognized. When I use the default serializer whithout this annotations I get a circular error.
Hi,
Symfony 3.1.7 + FOSRestBundle latest version
Then in my Article entity I added this annotation @groups({"article"}) with the right use statement.
Whit default serializer I get :
Whit JMS serializer (bundle) I get :
(I have two articles in db)
it seems like the "article" group is not recognized. When I use the default serializer whithout this annotations I get a circular error.
What's wrong ?
[EDIT] Same behavior with
The response still empty.
[EDIT2] fixed with
Now the groups annotations works fine.
The text was updated successfully, but these errors were encountered: