src/Phlexible/Bundle/MediaManagerBundle/Controller/FolderController.php
public function propertiesAction(Request $request)
    {
        $folderId = $request->get('folder_id');
        $volumeManager = $this->get('phlexible_media_manager.volume_manager');
        $volume = $volumeManager->getByFolderId($folderId);

        try {
            $folder = $volume->findFolder($folderId);

            $calculator = new SizeCalculator();
            $calculatedSize = $calculator->calculate($volume, $folder);

            $data = [
                'title' => $folder->getName(),
                'type' => 'folder',
                'path' => '/'.$folder->getPath(),
                'size' => $calculatedSize->getSize(),
                'files' => $calculatedSize->getNumFiles(),
                'folders' => $calculatedSize->getNumFolders(),
                'create_time' => $folder->getCreatedAt()->format('U') * 1000,
                'create_user' => $folder->getCreateUserId(),
                'modify_time' => $folder->getModifiedAt()->format('U') * 1000,
                'modify_user' => $folder->getModifyUserId(),
            ];
        } catch (\Exception $e) {
            $data = [];
        }

        return new JsonResponse($data);
    }
public function propertiesAction(Request $request)
    {
        $folderId = $request->get('folder_id');
        $volumeManager = $this->get('phlexible_media_manager.volume_manager');
        $volume = $volumeManager->getByFolderId($folderId);

        try {
            $folder = $volume->findFolder($folderId);

            $calculator = new SizeCalculator();
            $calculatedSize = $calculator->calculate($volume, $folder);

            $data = [
                'title' => $folder->getName(),
                'type' => 'folder',
                'path' => '/'.$folder->getPath(),
                'size' => $calculatedSize->getSize(),
                'files' => $calculatedSize->getNumFiles(),
                'folders' => $calculatedSize->getNumFolders(),
                'create_time' => $folder->getCreatedAt()->format('U') * 1000,
                'create_user' => $folder->getCreateUserId(),
                'modify_time' => $folder->getModifiedAt()->format('U') * 1000,
                'modify_user' => $folder->getModifyUserId(),
            ];
        } catch (\Exception $e) {
            $data = [];
        }

        return new JsonResponse($data);
    }
public function propertiesAction ( Request $ request ) { $ folderId = $ request -> get ( 'folder_id' ) ; $ volumeManager = $ this -> get ( 'phlexible_media_manager.volume_manager' ) ; $ volume = $ volumeManager -> getByFolderId ( $ folderId ) ; try { $ folder = $ volume -> findFolder ( $ folderId ) ; $ calculator = new SizeCalculator ( ) ; $ calculatedSize = $ calculator -> calculate ( $ volume , $ folder ) ; $ data = [ 'title' => $ folder -> getName ( ) , 'type' => 'folder' , 'path' => '/' . $ folder -> getPath ( ) , 'size' => $ calculatedSize -> getSize ( ) , 'files' => $ calculatedSize -> getNumFiles ( ) , 'folders' => $ calculatedSize -> getNumFolders ( ) , 'create_time' => $ folder -> getCreatedAt ( ) -> format ( 'U' ) * 1000 , 'create_user' => $ folder -> getCreateUserId ( ) , 'modify_time' => $ folder -> getModifiedAt ( ) -> format ( 'U' ) * 1000 , 'modify_user' => $ folder -> getModifyUserId ( ) , ] ; } catch ( \ Exception $ e ) { $ data = [ ] ; } return new JsonResponse ( $ data ) ; }
Folder properties.

@param Request $request

@return JsonResponse
@Route("/properties", name="mediamanager_folder_properties")
Folder properties .