getCachedUrlToPage() public method

Returns a array map url -> nodeId
public getCachedUrlToPage ( integer $domainId ) : array
$domainId integer
return array
Example #1
0
 /**
  * Returns the id of given path-info. Null if not existent.
  *
  * @return Node|null
  */
 public function searchPage()
 {
     $url = $this->getRequest()->getPathInfo();
     $page = null;
     $title = sprintf('Searching Page [%s]', $url);
     $this->stopwatch->start($title);
     if (!$page) {
         $domain = $this->pageStack->getCurrentDomain();
         $urls = $this->pageStack->getCachedUrlToPage($domain->getId());
         $possibleUrl = $url;
         $id = false;
         while (1) {
             if (isset($urls[$possibleUrl])) {
                 $id = $urls[$possibleUrl];
                 break;
             }
             if (false !== ($pos = strrpos($possibleUrl, '/'))) {
                 $possibleUrl = substr($possibleUrl, 0, $pos);
             } else {
                 break;
             }
         }
         if (!$id) {
             //set to startpage
             $id = $domain->getStartnodeId();
             $possibleUrl = '/';
         }
         $url = $possibleUrl;
         if ($url == '/') {
             $pageId = $this->pageStack->getCurrentDomain()->getStartnodeId();
             if (!$pageId > 0) {
                 $this->eventDispatcher->dispatch('core/domain-no-start-page');
             }
         } else {
             $pageId = $id;
         }
         /** @var \Jarves\Model\Node $page */
         $page = $this->pageStack->getPage($pageId);
     }
     $this->stopwatch->stop($title);
     return $page;
 }