public function getAction($id)
    {
        if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
            throw new InsufficientAuthenticationException('You must be authenticated to delete users');
        }

        $user = $this->getEntityManager()->find(get_class($this->getUser()), $id);

        if (!$user) {
            return $this->create404Response(sprintf('User not found with id %d', $id));
        }

        if (!$this->isGranted('VIEW', $user)) {
            throw new InsufficientAuthenticationException(sprintf('You are not authorized to view user with id %s', $id));
        }

        return new Response($this->formatItem($user), 200, ['Content-Type' => 'application/json']);
    }
public function getAction($id)
    {
        if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
            throw new InsufficientAuthenticationException('You must be authenticated to delete users');
        }

        $user = $this->getEntityManager()->find(get_class($this->getUser()), $id);

        if (!$user) {
            return $this->create404Response(sprintf('User not found with id %d', $id));
        }

        if (!$this->isGranted('VIEW', $user)) {
            throw new InsufficientAuthenticationException(sprintf('You are not authorized to view user with id %s', $id));
        }

        return new Response($this->formatItem($user), 200, ['Content-Type' => 'application/json']);
    }
public function getAction ( $ id ) { if ( ! $ this -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { throw new InsufficientAuthenticationException ( 'You must be authenticated to delete users' ) ; } $ user = $ this -> getEntityManager ( ) -> find ( get_class ( $ this -> getUser ( ) ) , $ id ) ; if ( ! $ user ) { return $ this -> create404Response ( sprintf ( 'User not found with id %d' , $ id ) ) ; } if ( ! $ this -> isGranted ( 'VIEW' , $ user ) ) { throw new InsufficientAuthenticationException ( sprintf ( 'You are not authorized to view user with id %s' , $ id ) ) ; } return new Response ( $ this -> formatItem ( $ user ) , 200 , [ 'Content-Type' => 'application/json' ] ) ; }
GET User.

@param int $id User ID
GET User .