Get a page entity by name

@param SiteEntity $site Site to lookup
@param string $pageName Page Name
@param string $pageType Page Type

@return null|PageEntity
501832
public function getPageByName(
        SiteEntity $site,
        $pageName,
        $pageType = PageTypes::NORMAL
    ) {
        $results = $this->getPagesByName(
            $site,
            $pageName,
            $pageType
        );

        if (empty($results)) {
            return null;
        }

        return $results[0];
    }
1275830
protected function getRevisionQuery(
        $siteId,
        $pageName,
        $pageType,
        $published = false
    ) {
        $revisionQueryBuilder = $this->_em->createQueryBuilder();
        $revisionQueryBuilder->select('page.pageId, revisions')
            ->select('PARTIAL page.{pageId}, revisions ')
            ->from(\Rcm\Entity\Page::class, 'page')
            ->join('page.revisions', 'revisions')
            ->where('page.site = :siteId')
            ->andWhere('page.name = :pageName')
            ->andWhere('page.pageType = :pageType')
            ->andWhere('revisions.published = :published')
            ->setParameter('siteId', $siteId)
            ->setParameter('pageName', $pageName)
            ->setParameter('pageType', $pageType)
            ->setParameter('published', $published)
            ->orderBy('revisions.revisionId', 'DESC');

        if ($published) {
            $revisionQueryBuilder->andWhere('revisions != page.publishedRevision');
        }

        return $revisionQueryBuilder->getQuery();
    }
156190
public function pageName($pageName = null)
    {
        if (null === $pageName) {
            return $this->pageName;
        }

        $this->pageName = $pageName;

        return $this;
    }
571347
public function actionGetElementUrls($elementType, array $criteria = [], $siteId = null): Response
    {
        return $this->asJson(RouteMap::$plugin->routes->getElementUrls($elementType, $criteria, $siteId));
    }
146426
def get_entities_query(namespace, workspace, etype, page=1,
                       page_size=100, sort_direction="asc",
                       filter_terms=None):
    

    # Initial parameters for pagination
    params = {
        "page" : page,
        "pageSize" : page_size,
        "sortDirection" : sort_direction
    }
    if filter_terms:
        params['filterTerms'] = filter_terms

    uri = "workspaces/{0}/{1}/entityQuery/{2}".format(namespace,workspace,etype)
    return __get(uri, params=params)
774294
private function getCurrentSite(Site $site = null)
    {
        if (null !== $site) {
            return $site;
        }

        if (null !== $this->application) {
            return $this->application->getSite();
        }

        return null;
    }
163870
public static function getIsSiteManagedSite($pageId)
    {

        $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
        try {
            $site = $siteFinder->getSiteByPageId($pageId);
        } catch (SiteNotFoundException $e) {
            return false;
        }

        return $site instanceof Site;
    }
562211
public PageResult<Entity> page(Entity where, Page page) throws SQLException{
		return db.page(fixEntity(where), page);
	}
807411
public function getUserTypeEntity($entityId, $fieldName) {
        /** @noinspection PhpDynamicAsStaticMethodCallInspection */
        $item = \CUserTypeEntity::GetList(array(), array(
            'ENTITY_ID' => $entityId,
            'FIELD_NAME' => $fieldName
        ))->Fetch();

        return (!empty($item)) ? $this->getUserTypeEntityById($item['ID']) : false;
    }
56024
public function updateSeoByEntity(BasePage $page, $entity)
    {
        //if no entity is provided
        if ($entity === null) {
            //we look for the entity of the page
            if ($page->getBusinessEntity() !== null) {
                $entity = $page->getBusinessEntity();
            }
        }

        //only if we have an entity instance
        if ($entity !== null) {
            //the page seo
            $pageSeo = $page->getSeo();

            //the page seo might not exist yet
            if ($pageSeo !== null) {
                $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);

                if ($businessEntity !== null) {
                    $businessProperties = $businessEntity->getBusinessPropertiesByType('seoable');

                    //parse the business properties
                    foreach ($businessProperties as $businessProperty) {
                        //parse of seo attributes
                        foreach ($this->pageSeoAttributes as $seoAttribute) {
                            $value = $this->getEntityAttributeValue($pageSeo, $seoAttribute);
                            // we only update value if its a string and (if its a VBP or its a BP where value is not defined)
                            if (is_string($value) && ($page instanceof VirtualBusinessPage || ($page instanceof BusinessPage && $value == null))) {
                                $value = $this->parameterConverter->setBusinessPropertyInstance(
                                    $value,
                                    $businessProperty,
                                    $entity
                                );
                            }
                            $this->setEntityAttributeValue($pageSeo, $seoAttribute, $value);
                        }
                    }
                }
            }
        }
    }
56938
public function getSiteByRootPageId($rootPageId)
    {
        $cacheId = 'SiteRepository' . '_' . 'getSiteByPageId' . '_' . $rootPageId;

        $methodResult = $this->runtimeCache->get($cacheId);
        if (!empty($methodResult)) {
            return $methodResult;
        }

        $methodResult = $this->buildSite($rootPageId);
        $this->runtimeCache->set($cacheId, $methodResult);

        return $methodResult;
    }
1239656
public function find($type, $slotname, PageVersion $version)
    {
        $cached = $this->getFromCache($type, $slotname, $version);

        if ($cached !== false) {
            return $cached;
        }

        $class = $this->getModelName($type);

        $chunk = $version->getId() ?
            $class::getSingleChunk($version, $slotname)->first()
            : null;

        $this->saveToCache($type, $slotname, $version, $chunk);

        return $chunk;
    }
34733
protected function getSiteByName($sites, $site_name)
    {
        $site_found = collect($sites)->filter(function ($site) use ($site_name) {
            return $site->name === $site_name;
        })->first();

        if ($site_found) {
            return $site_found;
        }
        return null;
    }
139167
public function updatePageParametersByEntity(BusinessPage $page, $entity)
    {
        //if no entity is provided
        if ($entity === null) {
            //we look for the entity of the page
            if ($page->getBusinessEntity() !== null) {
                $entity = $page->getBusinessEntity();
            }
        }

        //only if we have an entity instance
        if ($entity !== null) {
            $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);

            if ($businessEntity !== null) {
                $businessProperties = $this->getBusinessProperties($businessEntity);

                //parse the business properties
                foreach ($businessProperties as $businessProperty) {
                    //parse of seo attributes
                    foreach ($this->pageParameters as $pageAttribute) {
                        $string = $this->getEntityAttributeValue($page, $pageAttribute);
                        $updatedString = $this->parameterConverter->setBusinessPropertyInstance($string, $businessProperty, $entity);
                        $this->setEntityAttributeValue($page, $pageAttribute, $updatedString);
                    }
                }
            }
        }
    }
816601
private function getRouteName($entityClass, $routeType)
    {
        $this->init();

        if (isset($this->routeNames[$entityClass][$routeType])) {
            return $this->routeNames[$entityClass][$routeType];
        }

        $child = $entityClass;

        while ($parent = get_parent_class($child)) {
            if (isset($this->routeNames[$parent][$routeType])) {
                $this->routeNames[$entityClass][$routeType] = $this->routeNames[$parent][$routeType];

                return $this->routeNames[$entityClass][$routeType];
            }

            $child = $parent;
        }

        return null;
    }
950132
public PageResult<Entity> page(Entity where, Page page) throws SQLException {
		return this.page(where.getFieldNames(), where, page);
	}
156750
public function showBusinessPageByIdAction(Request $request, $entityId, $type)
    {
        $businessEntityHelper = $this->get('victoire_core.helper.queriable_business_entity_helper');
        $businessEntity = $businessEntityHelper->findById($type);
        $entity = $businessEntityHelper->getByBusinessEntityAndId($businessEntity, $entityId);

        $refClass = new \ReflectionClass($entity);

        $templateId = $this->get('victoire_business_page.business_page_helper')
            ->guessBestPatternIdForEntity($refClass, $entityId, $this->container->get('doctrine.orm.entity_manager'));

        $page = $this->get('victoire_page.page_helper')->findPageByParameters([
            'viewId'   => $templateId,
            'entityId' => $entityId,
            'locale'   => $request->getLocale(),
        ]);

        return $this->redirect(
            $this->generateUrl(
                'victoire_core_page_show',
                [
                    'url' => $page->getReference()->getUrl(),
                ]
            )
        );
    }