src/Controller/CmsHelperController.php
public function setAdminPortalWidthAction(Request $request)
    {
        $size = $request->get('size', 'full');

        /** @var \Networking\InitCmsBundle\Model\UserInterface $user */
        $user = $this->getUser();
        $status = 200;
        $message = 'OK';
        try {
            $user->setLastActivity(new \DateTime());
            $user->setAdminSetting('admin_portal_width', $size);
            /** @var \FOS\UserBundle\Doctrine\UserManager $userManager */
            $userManager = $this->get('fos_user.user_manager');
            $userManager->updateUser($user);
        } catch (\Exception $e) {
            $status = 500;
            $message = $e->getMessage();
        }

        return new JsonResponse(['message' => $message, 'size' => $size, 'admin_portal_width' => $user->getAdminSetting('admin_portal_width')], $status);
    }
public function setAdminPortalWidthAction(Request $request)
    {
        $size = $request->get('size', 'full');

        /** @var \Networking\InitCmsBundle\Model\UserInterface $user */
        $user = $this->getUser();
        $status = 200;
        $message = 'OK';
        try {
            $user->setLastActivity(new \DateTime());
            $user->setAdminSetting('admin_portal_width', $size);
            /** @var \FOS\UserBundle\Doctrine\UserManager $userManager */
            $userManager = $this->get('fos_user.user_manager');
            $userManager->updateUser($user);
        } catch (\Exception $e) {
            $status = 500;
            $message = $e->getMessage();
        }

        return new JsonResponse(['message' => $message, 'size' => $size, 'admin_portal_width' => $user->getAdminSetting('admin_portal_width')], $status);
    }
public function setAdminPortalWidthAction ( Request $ request ) { $ size = $ request -> get ( 'size' , 'full' ) ; /** @var \Networking\InitCmsBundle\Model\UserInterface $user */ $ user = $ this -> getUser ( ) ; $ status = 200 ; $ message = 'OK' ; try { $ user -> setLastActivity ( new \ DateTime ( ) ) ; $ user -> setAdminSetting ( 'admin_portal_width' , $ size ) ; /** @var \FOS\UserBundle\Doctrine\UserManager $userManager */ $ userManager = $ this -> get ( 'fos_user.user_manager' ) ; $ userManager -> updateUser ( $ user ) ; } catch ( \ Exception $ e ) { $ status = 500 ; $ message = $ e -> getMessage ( ) ; } return new JsonResponse ( [ 'message' => $ message , 'size' => $ size , 'admin_portal_width' => $ user -> getAdminSetting ( 'admin_portal_width' ) ] , $ status ) ; }
Set user Admin preferred width.

@param Request $request

@return JsonResponse
Set user Admin preferred width .