getPage

@param        $pageName
@param string $pageType

@return null|Page
760472
public function getPage($pageName, $pageType = PageTypes::NORMAL)
    {
        if ($this->pages->count() < 1) {
            return null;
        }

        /** @var \Rcm\Entity\Page $page */
        foreach ($this->pages as $page) {
            if ($page->getName() == $pageName
                && $page->getPageType() == $pageType
            ) {
                return $page;
            }
        }

        return null;
    }
1015438
public function getConfigType($pageType){

        $id = $this->pageTypeId($pageType);

        if(!isset($this->configTypes[$id])){
            throw new OutOfBoundsException("Pagetype '$id' not found");
        }

        return $this->configTypes[$id];

    }
1305540
public function getData($pageSize = 10, $pageNo = null)
    {
        if (empty($pageNo) && isset($_GET[$this->getPageVar()])) {
            $pageNo = intval($_GET[$this->getPageVar()]);
        }
        $pageNo = empty($pageNo) ? 1 : $pageNo;
        return [
            'pageSize' => $pageSize,
            'pageNo' => $pageNo,
            'totalCount' => $this->_dbInstance->getTotalCount(),
            'result' => $this->_dbInstance->getData($pageSize, $pageNo),
        ];
    }
1173289
public function sitePageExists(
        SiteEntity $site,
        $pageName,
        $pageType
    ) {
        try {
            $page = $this->getPageByName(
                $site,
                $pageName,
                $pageType
            );
        } catch (\Exception $e) {
            $page = null;
        }

        return !empty($page);
    }
97252
public static function pageGet(string $name, $defaultValue = null, ?string $page = null)
    {
        if ($page === null) {
            $page = $_SERVER['PHP_SELF'];
        }
        return self::get($name, $defaultValue, $page);
    }
782690
public function getOnlyPageIdByName($siteId, $name, $pageType = PageTypes::NORMAL)
    {
        $queryBuilder = $this->_em->createQueryBuilder();
        $queryBuilder->select('page.pageId')
            ->from(\Rcm\Entity\Page::class, 'page')
            ->where('page.name = :pageName')
            ->andWhere('page.pageType = :pageType')
            ->andWhere('page.site = :siteId')
            ->setParameter('pageName', $name)
            ->setParameter('pageType', $pageType)
            ->setParameter('siteId', $siteId);

        return $queryBuilder->getQuery()->getSingleScalarResult();
    }
260685
public function getPageRevisionList($siteId, $pageName, $pageType)
    {
        $publishedQueryBuilder = $this->_em->createQueryBuilder();

        $publishedQueryBuilder->select('PARTIAL page.{pageId}, published, staged ')
            ->from(\Rcm\Entity\Page::class, 'page')
            ->leftjoin('page.publishedRevision', 'published')
            ->leftjoin('page.stagedRevision', 'staged')
            ->where('page.site = :siteId')
            ->andWhere('page.name = :pageName')
            ->andWhere('page.pageType = :pageType')
            ->setParameter('siteId', $siteId)
            ->setParameter('pageName', $pageName)
            ->setParameter('pageType', $pageType);

        $lastDraftQueryBuilder = $this->getRevisionQuery(
            $siteId,
            $pageName,
            $pageType
        );

        $result = $publishedQueryBuilder->getQuery()->getSingleResult(
            \Doctrine\ORM\Query::HYDRATE_ARRAY
        );

        try {
            $lastDraft = $lastDraftQueryBuilder->setMaxResults(1)->getSingleResult(
                \Doctrine\ORM\Query::HYDRATE_ARRAY
            );
            $lastDraft = array_values($lastDraft['revisions']);
        } catch (NoResultException $e) {
            $lastDraft = [0 => null];
        }

        $result['lastDraft'] = $lastDraft[0];

        if ($result['lastDraft']['revisionId']
            == $result['stagedRevision']['revisionId']
        ) {
            $result['lastDraft'] = null;
        }

        return $result;
    }
1172325
public function showPage($pageName = 'index')
    {
        if (!$this->page->exists($pageName)) {
            return \Response::view($this->theme.'.404', array('global' => $this->global), 404);
        }

        $page = $this->page->get($pageName);

        $viewParamaters = array(
            'global' => $this->global,
            'page' => $page
        );

        if (\View::exists($this->theme.'.'.$pageName)) {
            return \View::make($this->theme.'.'.$pageName, $viewParamaters);
        } else {
            return \View::make($this->theme.'.page', $viewParamaters);
        }
    }
1069172
public static function getComponentByPageId($component, $page_id)
    {
        $page_id = (int)$page_id;
        $component = sql_prepare($component);

        $cache_key = 'components_' . $page_id . '_c_' . $component;
        $res = NULL;

        if (Settings::isCacheEnabled()) {
            $res = Cacher::getInstance()->getDefaultCacher()->get($cache_key);

            // Set from cache
            if ($res) {
                return $res;
            }
        }

        // Get from DB
        $res = NULL;
        /** @var PageComponentHistory $page */
        $page = PageComponentEntityRepository::findOneEntityByCriteria([
            'page_id' => $page_id,
            'component' => $component
        ]);

        if ($page) {
            $res = $page->getData();
        }

        // Save to cache
        if (Settings::isCacheEnabled()) {
            Cacher::getInstance()->getDefaultCacher()->set($cache_key, $res);
        }

        return $res;
    }
150587
public function getPage($id)
    {
        return isset($this->pages[$id])?$this->pages[$id]:null;
    }
1193697
protected function getAdditionalParameters($pageType)
    {
        $additionalParameters = '';

        $defaultRedirect = $this->settingsManager->isDefaultRedirectDisabled()
            ? 'false'
            : 'true';
        $jsRedirect      = $this->suppressRedirectJavascript
            ? 'false'
            : 'true';

        $additionalParameters .= "_shopgate.is_default_redirect_disabled = {$defaultRedirect};\n";
        $additionalParameters .= "    _shopgate.redirect_to_webapp = {$jsRedirect};\n";

        switch ($pageType) {
            case Shopgate_Helper_Redirect_TagsGeneratorInterface::PAGE_TYPE_CATEGORY:
                $additionalParameters .= '_shopgate.category_number = "{category_uid}";';
                break;

            case Shopgate_Helper_Redirect_TagsGeneratorInterface::PAGE_TYPE_PRODUCT:
                $additionalParameters .= '_shopgate.item_number = "{product_uid}";';
                break;

            case Shopgate_Helper_Redirect_TagsGeneratorInterface::PAGE_TYPE_CMS:
                $additionalParameters .= '_shopgate.cms_page = "{page_uid}";';
                break;

            case Shopgate_Helper_Redirect_TagsGeneratorInterface::PAGE_TYPE_BRAND:
                $additionalParameters .= '_shopgate.brand_name = "{brand_name}";';
                break;

            case Shopgate_Helper_Redirect_TagsGeneratorInterface::PAGE_TYPE_SEARCH:
                $additionalParameters .= '_shopgate.search_query = "{search_query:escaped}";';
                break;
        }

        return $additionalParameters . "\n";
    }
594886
public function getPage(int $pageNumber)
    {
        $pages = $this->getPages();

        if (isset($pages[$pageNumber - 1])) {
            return $pages[$pageNumber - 1];
        }

        return null;
    }
1324995
public function getByRouteName($routeName)
    {
        $this->fireLoadEvent();
        if (isset($this->pageTypesByRouteName[$routeName])) {
            return $this->pageTypesByRouteName[$routeName];
        }
    }
586492
private function getPageTypeLabel($pageTypeIdentifier)
    {
        $label             = '';
        $labelByIdentifier = $this->getPageTypeLabelMap();

        if (isset($labelByIdentifier[$pageTypeIdentifier])) {
            $label = $labelByIdentifier[$pageTypeIdentifier];
        }

        return $label;
    }
1103454
public function getNumberOfEnabledPages($type)
    {
        return $this
            ->createQueryBuilder('p')
            ->select('COUNT(p)')
            ->where('p.enabled = :enabled')
            ->andWhere('p.type = :type')
            ->setParameters([
                'enabled' => true,
                'type' => $type,
            ])
            ->getQuery()
            ->getSingleScalarResult();
    }
867406
public function buildRecordQuery($type, $uid, $pageId): Query
    {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $site = $siteRepository->getSiteByPageId($pageId);

        return $this->newSearchQuery('')
            ->useQueryString('*:*')
            ->useFilter('type:' . $type . ' AND uid:' . $uid, 'type')
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
            ->useReturnFields(ReturnFields::fromString('*'))
            ->useSortings(Sortings::fromString('type asc, title asc'))
            ->useQueryType('standard')
            ->getQuery();
    }
501832
public function getPageByName(
        SiteEntity $site,
        $pageName,
        $pageType = PageTypes::NORMAL
    ) {
        $results = $this->getPagesByName(
            $site,
            $pageName,
            $pageType
        );

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

        return $results[0];
    }