Exemplo n.º 1
0
 /**
  * Creates an URI used for linking to an Controller action.
  *
  * @param string $actionName Name of the action to be called
  * @param array $controllerArguments Additional query parameters. Will be merged with $this->arguments.
  * @param string $controllerName Name of the target controller. If not set, current ControllerName is used.
  * @param string $packageKey Name of the target package. If not set, current Package is used.
  * @param string $subPackageKey Name of the target SubPackage. If not set, current SubPackage is used.
  * @return string the rendered URI
  * @api
  * @see build()
  */
 public function uriFor($actionName = NULL, $controllerArguments = array(), $controllerName = NULL, $packageKey = NULL, $subPackageKey = NULL)
 {
     if ($actionName !== NULL) {
         $controllerArguments['@action'] = strtolower($actionName);
     }
     if ($controllerName !== NULL) {
         $controllerArguments['@controller'] = strtolower($controllerName);
     } else {
         $controllerArguments['@controller'] = strtolower($this->request->getControllerName());
     }
     if ($packageKey === NULL && $subPackageKey === NULL) {
         $subPackageKey = $this->request->getControllerSubpackageKey();
     }
     if ($packageKey === NULL) {
         $packageKey = $this->request->getControllerPackageKey();
     }
     $controllerArguments['@package'] = strtolower($packageKey);
     if (strlen($subPackageKey) > 0) {
         $controllerArguments['@subpackage'] = strtolower($subPackageKey);
     }
     if ($this->format !== NULL && $this->format !== '') {
         $controllerArguments['@format'] = $this->format;
     }
     $controllerArguments = $this->addNamespaceToArguments($controllerArguments);
     return $this->build($controllerArguments);
 }