I am confused about this question and I would be greatful if someone could give me an explanation with concrete examples. I generated a CRUD controller with Symfony and also implemented FOSRestBundle Controller for REST. They both return the same data and I am wondering, what is the difference and what can one do that the other cannot? I would like to stick with only one at this point in a prototype I am creating and expand as soon as I understand Symfony2's ways of doing things more. Here is the CRUD code from Symfony2:
/**
* Lists all User entities.
*
* @Route("/", name="user")
* @Method("GET")
* @Template()
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('SomethingWebServicesBundle:User')->findAll();
return array(
'entities' => $entities,
);
}
By changing this method name, I get a FOSRestController (with the configuration done correctly)
// "get_users" [GET] /users
public function getUsersAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('SomethingWebServicesBundle:Users')->findAll();
return array(
'entities' => $entities,
);
}