Neos\Flow\Mvc\Controller\ControllerContext::getRequest PHP Метод

getRequest() публичный Метод

Get the request of the controller
public getRequest ( ) : Neos\Flow\Mvc\RequestInterface
Результат Neos\Flow\Mvc\RequestInterface
    public function getRequest()
    {
        return $this->request;
    }

Usage Example

 /**
  * Build a list of sites
  *
  * @param ControllerContext $controllerContext
  * @return array
  */
 public function buildSiteList(ControllerContext $controllerContext)
 {
     $requestUriHost = $controllerContext->getRequest()->getHttpRequest()->getUri()->getHost();
     $domainsFound = false;
     $sites = array();
     foreach ($this->siteRepository->findOnline() as $site) {
         $uri = null;
         $active = false;
         /** @var $site Site */
         if ($site->hasActiveDomains()) {
             $activeHostPatterns = $site->getActiveDomains()->map(function ($domain) {
                 return $domain->getHostPattern();
             })->toArray();
             $active = in_array($requestUriHost, $activeHostPatterns, true);
             if ($active) {
                 $uri = $controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(true)->uriFor('index', array(), 'Backend\\Backend', 'Neos.Neos');
             } else {
                 $uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', array('site' => $site), 'Backend\\Backend', 'Neos.Neos');
             }
             $domainsFound = true;
         }
         $sites[] = array('name' => $site->getName(), 'nodeName' => $site->getNodeName(), 'uri' => $uri, 'active' => $active);
     }
     if ($domainsFound === false) {
         $uri = $controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(true)->uriFor('index', array(), 'Backend\\Backend', 'Neos.Neos');
         $sites[0]['uri'] = $uri;
     }
     return $sites;
 }
All Usage Examples Of Neos\Flow\Mvc\Controller\ControllerContext::getRequest