Answer the question
In order to leave comments, you need to log in
Unable to find template FOSUserBundle?
routing:
backend_users_api:
type: rest
resource: "@BackendUserBundle/Controller/Api/UserController.php"
prefix: /
sensio_framework_extra:
view:
annotations: false
router:
annotations: true
fos_rest:
format_listener:
rules:
- prefer_extension: false
routing_loader:
default_format: json
include_format: false
view:
view_response_listener: force
/**
* Class UserController
* @package Backend\UserBundle\Controller\Api
* @Route("/api")
*/
class UserController extends FOSRestController
{
/**
* @var EntityManager
* @DI\Inject("doctrine.orm.entity_manager")
*/
public $em;
/**
* @Rest\Route("/all")
* @Rest\View()
*/
public function allAction()
{
$users = $this->em->getRepository('AppBundle:User')->findAll();
return array('users' => $users);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question