public function setUri(__Uri $uri) { $this->_uri = $uri; $this->setActionIdentity($uri->getActionIdentity()); //Add all parameters to the current __Request instance $request_parameters = $uri->getParameters(); foreach ($request_parameters as $request_parameter_name => $request_parameter_value) { $this->addParameter($request_parameter_name, $request_parameter_value, REQMETHOD_GET); } }
<?php //Discompound an url into single elements: $uri = __UriFactory::getInstance()->createUri('http://mydomain/login.action'); $parameters = $uri->getParameters(); $controller_code = $uri->getControllerCode(); $action_code = $uri->getActionCode(); $route_id = $uri->getRouteId(); //we can also know which front controller attends the request: $front_controller_class = $uri->getFrontControllerClass(); //Compound an url from single elements: $uri2 = new __Uri(); $uri2->setControllerCode($controller_code); $uri2->setActionCode($action_code); $uri2->setParameters($parameters); $uri2->setRouteId($route_id); $url = $uri2->getUrl(); //will return 'http://mydomain/login.action'
<?php //Compound an url from single elements: $uri2 = new __Uri(); $uri2->setControllerCode('invoices'); $uri2->setParameters(array('invoice_id' => 10948)); $uri2->setRouteId('invoice_search'); $url = $uri2->getUrl(); //--> /invoices/10948.html $url = $uri2->getAbsoluteUrl(); //--> http://yourdomain.com/invoices/10948.html