You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
661 B
32 lines
661 B
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Repository\UserRepository;
|
|
use FOS\RestBundle\Controller\Annotations as Rest;
|
|
use FOS\RestBundle\Controller\FOSRestController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
/**
|
|
* @Rest\RouteResource("User")
|
|
*/
|
|
class UserController extends FOSRestController
|
|
{
|
|
protected $userRepository;
|
|
|
|
public function __construct(UserRepository $userRepository)
|
|
{
|
|
$this->userRepository = $userRepository;
|
|
}
|
|
|
|
/**
|
|
* @Rest\View()
|
|
*/
|
|
public function cgetAction()
|
|
{
|
|
$users = $this->userRepository->findAll();
|
|
return $this->view($users, Response::HTTP_OK);
|
|
}
|
|
|
|
}
|