uriFor() public method

Creates an URI used for linking to an Controller action.
See also: build()
public uriFor ( string $actionName, array $controllerArguments = [], string $controllerName = null, string $packageKey = null, string $subPackageKey = null ) : string
$actionName string Name of the action to be called
$controllerArguments array Additional query parameters. Will be merged with $this->arguments.
$controllerName string Name of the target controller. If not set, current ControllerName is used.
$packageKey string Name of the target package. If not set, current Package is used.
$subPackageKey string Name of the target SubPackage. If not set, current SubPackage is used.
return string the rendered URI
コード例 #1
0
 /**
  * @test
  */
 public function uriForPrefixesControllerArgumentsWithSubRequestArgumentNamespaceOfParentRequestIfCurrentRequestHasNoNamespace()
 {
     $expectedArguments = ['SubNamespace' => ['arg1' => 'val1', '@action' => 'someaction', '@controller' => 'somecontroller', '@package' => 'somepackage']];
     $this->mockMainRequest->expects($this->any())->method('getArguments')->will($this->returnValue([]));
     $this->mockSubSubRequest->expects($this->any())->method('getArgumentNamespace')->will($this->returnValue(''));
     $this->uriBuilder->setRequest($this->mockSubSubRequest);
     $this->uriBuilder->uriFor('SomeAction', ['arg1' => 'val1'], 'SomeController', 'SomePackage');
     $this->assertEquals($expectedArguments, $this->uriBuilder->getLastArguments());
 }
コード例 #2
0
ファイル: RedirectFinisher.php プロジェクト: neos/form
 /**
  * @param ActionRequest $request
  * @return string
  */
 protected function buildActionUri(ActionRequest $request)
 {
     $packageKey = $this->parseOption('package');
     $controllerName = $this->parseOption('controller');
     $actionName = $this->parseOption('action');
     $arguments = $this->parseOption('arguments');
     $subpackageKey = null;
     if ($packageKey !== null && strpos($packageKey, '\\') !== false) {
         list($packageKey, $subpackageKey) = explode('\\', $packageKey, 2);
     }
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($request);
     $uriBuilder->reset();
     $uri = $uriBuilder->uriFor($actionName, $arguments, $controllerName, $packageKey, $subpackageKey);
     return $uri;
 }
コード例 #3
0
 /**
  * Returns a specific URI string to redirect to after the logout; or NULL if there is none.
  * In case of NULL, it's the responsibility of the AuthenticationController where to redirect,
  * most likely to the LoginController's index action.
  *
  * @param ActionRequest $actionRequest
  * @return string A possible redirection URI, if any
  */
 public function getAfterLogoutRedirectionUri(ActionRequest $actionRequest)
 {
     $lastVisitedNode = $this->getLastVisitedNode('live');
     if ($lastVisitedNode === null) {
         return null;
     }
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($actionRequest);
     $uriBuilder->setFormat('html');
     $uriBuilder->setCreateAbsoluteUri(true);
     return $uriBuilder->uriFor('show', array('node' => $lastVisitedNode), 'Frontend\\Node', 'Neos.Neos');
 }