1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace App\Controller\Rest;
use App\Controller\ExceptionFOSRestController;
use App\Entity\User;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
class RestController extends ExceptionFOSRestController
{
/**
* Renvoi le type d'utilisateur
*
* @Route("/api/{user}/type", methods={"GET"})
* @SWG\Response(
* response=200,
* description="Returns the type of user",
* @SWG\Schema(
* type="string"
* )
* )
* @SWG\Parameter(
* name="order",
* in="query",
* type="string",
* description="The field used to order rewards"
* )
* @SWG\Tag(name="Utilisateurs")
*/
public function fetchUserTypeAction(User $user)
{
try {
return new JsonResponse('yes');
// return 'yes';
} catch (\Exception $e) {
$this->throwFosrestSupportedException($exception);
}
}
}