private function getUserById($id)
    {
        $user = $this->userService->findUserById($id);

        if (empty($user)) {
            throw $this->createNotFoundException('user not found');
        }

        return $user;
    }
private function getUserById($id)
    {
        $user = $this->userService->findUserById($id);

        if (empty($user)) {
            throw $this->createNotFoundException('user not found');
        }

        return $user;
    }
private function getUserById ( $ id ) { $ user = $ this -> userService -> findUserById ( $ id ) ; if ( empty ( $ user ) ) { throw $ this -> createNotFoundException ( 'user not found' ) ; } return $ user ; }
Gets the user by the user's id

@param $id
@return null|object|BaseUser
Gets the user by the user s id