8000 [Routing] changed UrlGeneratorInterface::generate() signature to allo… · symfony/symfony@04ac1fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 04ac1fd

Browse files
committed
[Routing] changed UrlGeneratorInterface::generate() signature to allow passing objects instead of arrays
1 parent 1543ad1 commit 04ac1fd

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/Symfony/Bridge/Twig/Extension/RoutingExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function getFunctions()
4040
);
4141
}
4242

43-
public function getPath($name, array $parameters = array())
43+
public function getPath($name, $parameters = array())
4444
{
4545
return $this->generator->generate($name, $parameters, false);
4646
}
4747

48-
public function getUrl($name, array $parameters = array())
48+
public function getUrl($name, $parameters = array())
4949
{
5050
return $this->generator->generate($name, $parameters, true);
5151
}

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class Controller extends ContainerAware
3434
* Generates a URL from the given parameters.
3535
*
3636
* @param string $name The name of the route
37-
* @param array $parameters An array of parameters
37+
* @param mixed $parameters An array of parameters
3838
* @param Boolean $absolute Whether to generate an absolute URL
3939
*
4040
* @return string The generated URL
4141
*/
42-
public function generateUrl($route, array $parameters = array(), $absolute = false)
42+
public function generateUrl($route, $parameters = array(), $absolute = false)
4343
{
4444
return $this->container->get('router')->generate($route, $parameters, $absolute);
4545
}

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function __construct(UrlGeneratorInterface $router)
3737
* Generates a URL from the given parameters.
3838
*
3939
* @param string $name The name of the route
40-
* @param array $parameters An array of parameters
40+
* @param mixed $parameters An array of parameters
4141
* @param Boolean $absolute Whether to generate an absolute URL
4242
*
4343
* @return string The generated URL
4444
*/
45-
public function generate($name, array $parameters = array(), $absolute = false)
45+
public function generate($name, $parameters = array(), $absolute = false)
4646
{
4747
return $this->generator->generate($name, $parameters, $absolute);
4848
}

src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function get{$escapedName}RouteInfo()
7878

7979
return <<<EOF
8080
81-
public function generate(\$name, array \$parameters = array(), \$absolute = false)
81+
public function generate(\$name, \$parameters = array(), \$absolute = false)
8282
{
8383
if (!isset(self::\$declaredRouteNames[\$name])) {
8484
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', \$name));

src/Symfony/Component/Routing/Generator/UrlGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class UrlGenerator implements UrlGeneratorInterface
3333
'%2F' => '/',
3434
);
3535

36-
private $routes;
37-
private $cache;
36+
protected $routes;
37+
protected $cache;
3838

3939
/**
4040
* Constructor.
@@ -77,7 +77,7 @@ public function getContext()
7777
* Generates a URL from the given parameters.
7878
*
7979
* @param string $name The name of the route
80-
* @param array $parameters An array of parameters
80+
* @param mixed $parameters An array of parameters
8181
* @param Boolean $absolute Whether to generate an absolute URL
8282
*
8383
* @return string The generated URL
@@ -86,7 +86,7 @@ public function getContext()
8686
*
8787
* @api
8888
*/
89-
public function generate($name, array $parameters = array(), $absolute = false)
89+
public function generate($name, $parameters = array(), $absolute = false)
9090
{
9191
if (null === $route = $this->routes->get($name)) {
9292
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));

src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
2626
* Generates a URL from the given parameters.
2727
*
2828
* @param string $name The name of the route
29-
* @param array $parameters An array of parameters
29+
* @param mixed $parameters An array of parameters
3030
* @param Boolean $absolute Whether to generate an absolute URL
3131
*
3232
* @return string The generated URL
3333
*
3434
* @api
3535
*/
36-
function generate($name, array $parameters = array(), $absolute = false);
36+
function generate($name, $parameters = array(), $absolute = false);
3737
}

src/Symfony/Component/Routing/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ public function getContext()
171171
* Generates a URL from the given parameters.
172172
*
173173
* @param string $name The name of the route
174-
* @param array $parameters An array of parameters
174+
* @param mixed $parameters An array of parameters
175175
* @param Boolean $absolute Whether to generate an absolute URL
176176
*
177177
* @return string The generated URL
178178
*/
179-
public function generate($name, array $parameters = array(), $absolute = false)
179+
public function generate($name, $parameters = array(), $absolute = false)
180180
{
181181
return $this->getGenerator()->generate($name, $parameters, $absolute);
182182
}

0 commit comments

Comments
 (0)
0