Skip to content

Commit

Permalink
[Routing] changed UrlGeneratorInterface::generate() signature to allo…
Browse files Browse the repository at this point in the history
…w passing objects instead of arrays
  • Loading branch information
fabpot committed Jul 26, 2011
1 parent 1543ad1 commit 04ac1fd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/RoutingExtension.php
Expand Up @@ -40,12 +40,12 @@ public function getFunctions()
);
}

public function getPath($name, array $parameters = array())
public function getPath($name, $parameters = array())
{
return $this->generator->generate($name, $parameters, false);
}

public function getUrl($name, array $parameters = array())
public function getUrl($name, $parameters = array())
{
return $this->generator->generate($name, $parameters, true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
Expand Up @@ -34,12 +34,12 @@ class Controller extends ContainerAware
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param array $parameters An array of parameters
* @param mixed $parameters An array of parameters
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
*/
public function generateUrl($route, array $parameters = array(), $absolute = false)
public function generateUrl($route, $parameters = array(), $absolute = false)
{
return $this->container->get('router')->generate($route, $parameters, $absolute);
}
Expand Down
Expand Up @@ -37,12 +37,12 @@ public function __construct(UrlGeneratorInterface $router)
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param array $parameters An array of parameters
* @param mixed $parameters An array of parameters
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
*/
public function generate($name, array $parameters = array(), $absolute = false)
public function generate($name, $parameters = array(), $absolute = false)
{
return $this->generator->generate($name, $parameters, $absolute);
}
Expand Down
Expand Up @@ -78,7 +78,7 @@ private function get{$escapedName}RouteInfo()

return <<<EOF
public function generate(\$name, array \$parameters = array(), \$absolute = false)
public function generate(\$name, \$parameters = array(), \$absolute = false)
{
if (!isset(self::\$declaredRouteNames[\$name])) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', \$name));
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Routing/Generator/UrlGenerator.php
Expand Up @@ -33,8 +33,8 @@ class UrlGenerator implements UrlGeneratorInterface
'%2F' => '/',
);

private $routes;
private $cache;
protected $routes;
protected $cache;

/**
* Constructor.
Expand Down Expand Up @@ -77,7 +77,7 @@ public function getContext()
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param array $parameters An array of parameters
* @param mixed $parameters An array of parameters
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
Expand All @@ -86,7 +86,7 @@ public function getContext()
*
* @api
*/
public function generate($name, array $parameters = array(), $absolute = false)
public function generate($name, $parameters = array(), $absolute = false)
{
if (null === $route = $this->routes->get($name)) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
Expand Down
Expand Up @@ -26,12 +26,12 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param array $parameters An array of parameters
* @param mixed $parameters An array of parameters
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
*
* @api
*/
function generate($name, array $parameters = array(), $absolute = false);
function generate($name, $parameters = array(), $absolute = false);
}
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/Router.php
Expand Up @@ -171,12 +171,12 @@ public function getContext()
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param array $parameters An array of parameters
* @param mixed $parameters An array of parameters
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
*/
public function generate($name, array $parameters = array(), $absolute = false)
public function generate($name, $parameters = array(), $absolute = false)
{
return $this->getGenerator()->generate($name, $parameters, $absolute);
}
Expand Down

0 comments on commit 04ac1fd

Please sign in to comment.