lithium\action\Request::to PHP Method

to() public method

Overrides lithium\net\http\Request::to() to provide the correct options for generating URLs. For information about this method, see the parent implementation.
See also: lithium\net\http\Request::to()
public to ( string $format, array $options = [] ) : mixed
$format string The format to convert to.
$options array Override options.
return mixed The return value type depends on `$format`.
    public function to($format, array $options = array())
    {
        $defaults = array('path' => $this->env('base') . '/' . $this->url);
        return parent::to($format, $options + $defaults);
    }

Usage Example

Example #1
0
 /**
  * Tests that `action\Request` correctly inherits the functionality of the `to()` method
  * inherited from `lithium\net\http\Request`.
  */
 public function testConvertToUrl()
 {
     $request = new Request(array('env' => array('HTTP_HOST' => 'foo.com', 'HTTPS' => 'on'), 'base' => '/the/base/path', 'url' => '/the/url', 'query' => array('some' => 'query', 'parameter' => 'values')));
     $expected = 'https://foo.com/the/base/path/the/url?some=query&parameter=values';
     $this->assertEqual($expected, $request->to('url'));
 }
All Usage Examples Of lithium\action\Request::to