28 lines
689 B
PHP

<?php
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
class UserApiController extends ApiController
{
/**
* @Route(
* "/api/1.0/main/whoami.{_format}",
* name="chill_main_user_whoami",
* requirements={
* "_format": "json"
* }
* )
*/
public function whoami($_format): JsonResponse
{
return $this->json($this->getUser(), JsonResponse::HTTP_OK, [],
[ "groups" => [ "read" ] ]);
}
}