@param View[]        $views
@param EntityManager $em

@return WebViewInterface[]
350047
public function getReferencableViews($views, EntityManager $em)
    {
        $referencableViews = [];
        if (!$views instanceof \Traversable && !is_array($views)) {
            $views = [$views];
        }

        $businessPages = $this->findBusinessPages($views);
        foreach ($views as $view) {
            if ($view instanceof BusinessTemplate) {
                $entities = $this->businessPageHelper->getEntitiesAllowed($view, $em);

                // for each business entity
                foreach ($entities as $k => $entity) {
                    $currentTemplate = clone $view;
                    $page = $this->businessPageBuilder->generateEntityPageFromTemplate($currentTemplate, $entity, $em);
                    $this->businessPageBuilder->updatePageParametersByEntity($page, $entity);
                    if (!array_key_exists(ViewReferenceHelper::generateViewReferenceId($page, $entity), $businessPages)) {
                        $referencableViews[] = ['view' => $page];
                    }
                }
            } elseif ($view instanceof WebViewInterface) {
                $referencableView = ['view' => $view];
                if ($view->getChildren()) {
                    $referencableView['children'] = $this->getReferencableViews($view->getChildren(), $em);
                }
                $referencableViews[] = $referencableView;
            }
        }

        return $referencableViews;
    }
1142994
protected function getViewResponse(Entity $entity)
    {
        $response = $this->getHtmlResponse();
        $response->setTemplateId($this->getViewTemplateId());
        $response->setData(
                $this->getItemName(),
                $entity->getFieldsData()
        );
        $response->appendToTitle(sprintf(
            _('%s %s'),
            ucfirst($this->getItemName()),
            $entity->getId()
        ));

        return $response;
    }
1249607
protected function _getPortableViewsList($views)
    {
        $list = [];
        foreach ($views as $value) {
            $view = $this->_getPortableViewDefinition($value);

            if (! $view) {
                continue;
            }

            $viewName        = strtolower($view->getQuotedName($this->_platform));
            $list[$viewName] = $view;
        }

        return $list;
    }
947383
private function getBusinessProperties(View $view)
    {
        $businessProperties = [];

        if ($view instanceof BusinessTemplate) {
            //we can use the business entity properties on the seo
            $businessEntity = $this->get('victoire_core.helper.business_entity_helper')->findById($view->getBusinessEntityId());
            $businessProperties = $businessEntity->getBusinessPropertiesByType('seoable');
        }

        return $businessProperties;
    }
383727
protected function view($viewOrModel = null, $model = null, $layout = null) {
        return new ViewResult($viewOrModel, $model, $layout);
    }
243563
public function putViews($id, array $views, $guestSpaceId = null, $revision = -1): array
    {
        $options = ['json' => [
            'app' => $id,
            'views' => $views,
            'revision' => $revision
        ]];

        /** @var JsonStream $stream */
        $stream = $this->client
            ->put(KintoneApi::generateUrl('preview/app/views.json', $guestSpaceId), $options)
            ->getBody();

        return $stream->jsonSerialize();
    }
353210
public function getPage(EntityManager $em)
    {
        return $em->getRepository($this->getPageEntityname())->find($this->getPageId());
    }
151302
public function applyView($view_path, array $params)
    {
        $out = $this->templating
                ->render($view_path, $params);
        
        return html_entity_decode($out);
    }
1024520
public function getRef(EntityManager $em)
    {
        return $em->getRepository($this->getRefEntityName())->find($this->getRefId());
    }
764597
public static function view(string $view, array $data = [])
  {
    $global = Self::$variables::get();
    $data = array_merge($global, $data);

    return Self::$view->view($view, $data);
  }
87045
protected function loadItem($em, $data, $attributes, $association)
    {
        if (is_object($data)) {
            if (get_class($data) === 'DateTime') {
                return array('type' => 'DateTime', 'name' => $data->format('r'));
            }

            if (array_key_exists('targetEntity', $attributes)) {
                $targetClass = $em->getClassMetadata($attributes['targetEntity']);

//                var_dump($association);die();
                $className = get_class($data);

//                die($className);
                $entityProvider = new EntityProvider($className);

//                $meta = $em->getClassMetadata($className);
                $identifier = $targetClass->getSingleIdentifierFieldName();
                $identifierMethodName = 'get'.ucfirst($identifier);

                return array(
                    'type' => 'reference',
                    'name' => $entityProvider->getName().'_'.$data->$identifierMethodName(),
                );
            }

            throw new \Exception('Unknown data class: '.get_class($data));
        }

        if (!is_array($data)) {
            return str_replace(array("\r\n",   "\r", "\n"), '\n', htmlspecialchars($data, ENT_QUOTES));
        }

        return $data;
    }
740310
public function setView($view, array $data = [])
    {
        $this->view = $view;

        $this->data = $data;

        return $this;
    }
1242100
public function findByViewReferences(array $viewReferences)
    {
        $pageIds = [];
        foreach ($viewReferences as $viewReference) {
            if ($viewReference instanceof BusinessPageReference) {
                $pageIds[] = $viewReference->getTemplateId();
            } else {
                $pageIds[] = $viewReference->getViewId();
            }
        }

        $qb = $this->getInstance();
        $qb->andWhere($this->mainAlias.'.id IN (:pageIds)')
            ->setParameter('pageIds', $pageIds);

        $pages = $qb->getQuery()->getResult();

        foreach ($pages as $page) {
            $pageId = $page->getId();
            $viewReference = array_filter(
                $viewReferences,
                function ($e) use ($pageId) {
                    return $e->getViewId() == $pageId;
                });
            if (!empty($viewReference[0])) {
                $page->setCurrentLocale($viewReference[0]->getLocale());
            }
        }

        return $pages;
    }
471807
protected function makeView(string $view, Collection $breadcrumbs): View
    {
        return $this->factory->make($view, compact('breadcrumbs'));
    }
386948
public function buildReference(View $businessPage, EntityManager $em)
    {
        $referenceId = ViewReferenceHelper::generateViewReferenceId($businessPage);
        $businessPageReference = new BusinessPageReference();
        $businessPageReference->setId($referenceId);
        $businessPageReference->setLocale($businessPage->getCurrentLocale());
        $businessPageReference->setName($businessPage->getName());
        $businessPageReference->setViewId($businessPage->getId());
        $businessPageReference->setTemplateId($businessPage->getTemplate()->getId());
        $businessPageReference->setSlug($businessPage->getSlug());
        $businessPageReference->setEntityId($businessPage->getBusinessEntity()->getId());
        $businessPageReference->setEntityNamespace($em->getClassMetadata(get_class($businessPage->getBusinessEntity()))->name);
        $businessPageReference->setViewNamespace($em->getClassMetadata(get_class($businessPage))->name);
        if ($parent = $businessPage->getParent()) {
            $parent->setCurrentLocale($businessPage->getCurrentLocale());
            $businessPageReference->setParent(ViewReferenceHelper::generateViewReferenceId($parent));
        }

        return $businessPageReference;
    }
1373604
public function view($view, $data = [], $mergeData = [])
    {
        return $this->app['view']->make($this->viewname($view), $data, $mergeData);
    }
795281
protected function view(DataMap $params, ?string $viewName = null): ViewResult
    {
        if ($viewName == null) {
            $routeInfo = Application::$app->routeInfo;
            $viewName = $routeInfo->controllerName . '/' . $routeInfo->actionName;
        }
        return new ViewResult($viewName, $this->layout, $params);
    }