I'm trying to encapsulate data from my symfony api.
There is my serialization.yml:
AppBundle\Entity\Parcs:
attributes:
id:
groups: ['parcs']
latitude:
groups: ['parcs']
longitude:
groups: ['parcs']
sac:
groups: ['parcs']
name:
groups: ['parcs']
And there is my ParcsController:
/**
* @Rest\View(serializerGroups={"parcs"})
* @Rest\Get("/parcs")
*/
public function getParcsAction(Request $request)
{
$parcs = $this->get('doctrine.orm.entity_manager')
->getRepository('AppBundle:Parcs')
->findAll();
/* @var $parcs Parc[] */
return $parcs;
}
With those data i want to get [id, sac, name, Coordinate[latitude, longitude]].
PS : I'm still learning symfony if you have a good tutorial I'll be happy too. Thx a lot!