Sulu\Bundle\ContactBundle\Controller\AbstractMediaController::getMultipleView PHP Метод

getMultipleView() защищенный Метод

Returns a view containing all media of an entity.
protected getMultipleView ( string $entityName, string $routeName, AbstractContactManager $contactManager, string $id, Request $request ) : Response
$entityName string
$routeName string
$contactManager Sulu\Bundle\ContactBundle\Contact\AbstractContactManager
$id string
$request Request
Результат Response
    protected function getMultipleView($entityName, $routeName, AbstractContactManager $contactManager, $id, $request)
    {
        try {
            $locale = $this->getUser()->getLocale();
            if ($request->get('flat') === 'true') {
                /** @var RestHelperInterface $restHelper */
                $restHelper = $this->get('sulu_core.doctrine_rest_helper');
                /** @var DoctrineListBuilderFactory $factory */
                $factory = $this->get('sulu_core.doctrine_list_builder_factory');
                $listBuilder = $factory->create($entityName);
                $fieldDescriptors = $this->getFieldDescriptors($entityName, $id);
                $listBuilder->setIdField($fieldDescriptors['id']);
                $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);
                $listResponse = $listBuilder->execute();
                $listResponse = $this->addThumbnails($listResponse, $locale);
                $listResponse = $this->addUrls($listResponse, $locale);
                $list = new ListRepresentation($listResponse, self::$mediaEntityKey, $routeName, array_merge(['id' => $id], $request->query->all()), $listBuilder->getCurrentPage(), $listBuilder->getLimit(), $listBuilder->count());
            } else {
                $media = $contactManager->getById($id, $locale)->getMedias();
                $list = new CollectionRepresentation($media, self::$mediaEntityKey);
            }
            $view = $this->view($list, 200);
        } catch (EntityNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        }
        return $this->handleView($view);
    }