public function menuAction()
    {
        $workspaces = [];
        $personalWs = null;

        $user = null;
        $token = $this->tokenStorage->getToken();
        if ($token) {
            $user = $token->getUser();
        }

        if ($user instanceof User) {
            $personalWs = $user->getPersonalWorkspace();
            $workspaces = $this->workspaceManager->getRecentWorkspaceForUser($user, $this->utils->getRoles($token));
        }

        return new JsonResponse([
            'creatable' => $this->authorization->isGranted('CREATE', new Workspace()),
            'personal' => $personalWs ? $this->serializer->serialize($personalWs, [Options::SERIALIZE_MINIMAL]) : null,
            'history' => array_map(function (Workspace $workspace) {
                return $this->serializer->serialize($workspace, [Options::SERIALIZE_MINIMAL]);
            }, $workspaces),
        ]);
    }
public function menuAction()
    {
        $workspaces = [];
        $personalWs = null;

        $user = null;
        $token = $this->tokenStorage->getToken();
        if ($token) {
            $user = $token->getUser();
        }

        if ($user instanceof User) {
            $personalWs = $user->getPersonalWorkspace();
            $workspaces = $this->workspaceManager->getRecentWorkspaceForUser($user, $this->utils->getRoles($token));
        }

        return new JsonResponse([
            'creatable' => $this->authorization->isGranted('CREATE', new Workspace()),
            'personal' => $personalWs ? $this->serializer->serialize($personalWs, [Options::SERIALIZE_MINIMAL]) : null,
            'history' => array_map(function (Workspace $workspace) {
                return $this->serializer->serialize($workspace, [Options::SERIALIZE_MINIMAL]);
            }, $workspaces),
        ]);
    }
public function menuAction ( ) { $ workspaces = [ ] ; $ personalWs = null ; $ user = null ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token ) { $ user = $ token -> getUser ( ) ; } if ( $ user instanceof User ) { $ personalWs = $ user -> getPersonalWorkspace ( ) ; $ workspaces = $ this -> workspaceManager -> getRecentWorkspaceForUser ( $ user , $ this -> utils -> getRoles ( $ token ) ) ; } return new JsonResponse ( [ 'creatable' => $ this -> authorization -> isGranted ( 'CREATE' , new Workspace ( ) ) , 'personal' => $ personalWs ? $ this -> serializer -> serialize ( $ personalWs , [ Options :: SERIALIZE_MINIMAL ] ) : null , 'history' => array_map ( function ( Workspace $ workspace ) { return $ this -> serializer -> serialize ( $ workspace , [ Options :: SERIALIZE_MINIMAL ] ) ; } , $ workspaces ) , ] ) ; }
Gets the main workspace menu for the current user.

@Route("/menu", name="apiv2_workspace_menu")
@Method("GET")

@return JsonResponse
Gets the main workspace menu for the current user .