src/Phlexible/Bundle/ElementBundle/Controller/LocksController.php
public function listAction()
    {
        $lockManager = $this->get('phlexible_element.element_lock_manager');
        $userManager = $this->get('phlexible_user.user_manager');

        $locks = $lockManager->findAll();

        $data = [];
        foreach ($locks as $lock) {
            /* @var $lock ElementLock */
            $username = '(unknown user)';
            $user = $userManager->find($lock->getUserId());
            if ($user) {
                $username = $user->getDisplayName();
            }

            $data[] = [
                'id' => $lock->getId(),
                'uid' => $lock->getUserId(),
                'user' => $username,
                'ts' => $lock->getLockedAt()->format('Y-m-d H:i:s'),
                'eid' => $lock->getElement()->getEid(),
                'lock_type' => $lock->getType(),
            ];
        }

        return new JsonResponse(['locks' => $data]);
    }
public function listAction()
    {
        $lockManager = $this->get('phlexible_element.element_lock_manager');
        $userManager = $this->get('phlexible_user.user_manager');

        $locks = $lockManager->findAll();

        $data = [];
        foreach ($locks as $lock) {
            /* @var $lock ElementLock */
            $username = '(unknown user)';
            $user = $userManager->find($lock->getUserId());
            if ($user) {
                $username = $user->getDisplayName();
            }

            $data[] = [
                'id' => $lock->getId(),
                'uid' => $lock->getUserId(),
                'user' => $username,
                'ts' => $lock->getLockedAt()->format('Y-m-d H:i:s'),
                'eid' => $lock->getElement()->getEid(),
                'lock_type' => $lock->getType(),
            ];
        }

        return new JsonResponse(['locks' => $data]);
    }
public function listAction ( ) { $ lockManager = $ this -> get ( 'phlexible_element.element_lock_manager' ) ; $ userManager = $ this -> get ( 'phlexible_user.user_manager' ) ; $ locks = $ lockManager -> findAll ( ) ; $ data = [ ] ; foreach ( $ locks as $ lock ) { /* @var $lock ElementLock */ $ username = '(unknown user)' ; $ user = $ userManager -> find ( $ lock -> getUserId ( ) ) ; if ( $ user ) { $ username = $ user -> getDisplayName ( ) ; } $ data [ ] = [ 'id' => $ lock -> getId ( ) , 'uid' => $ lock -> getUserId ( ) , 'user' => $ username , 'ts' => $ lock -> getLockedAt ( ) -> format ( 'Y-m-d H:i:s' ) , 'eid' => $ lock -> getElement ( ) -> getEid ( ) , 'lock_type' => $ lock -> getType ( ) , ] ; } return new JsonResponse ( [ 'locks' => $ data ] ) ; }
List locks.

@return JsonResponse
@Route("/list", name="locks_list")
List locks .