Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow UrlConcrete Generation to be overriden #98

Merged
merged 2 commits into from
Jun 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions EventListener/RouteAnnotationEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getOptions($name, Route $route)
* @return UrlConcrete
* @throws \InvalidArgumentException
*/
private function getUrlConcrete($name, $options)
protected function getUrlConcrete($name, $options)
{
try {
$url = new UrlConcrete(
Expand All @@ -165,19 +165,21 @@ private function getUrlConcrete($name, $options)

/**
* @param $name
* @param array $params Route additional parameters
* @return string
* @throws \InvalidArgumentException
*/
private function getRouteUri($name)
protected function getRouteUri($name, $params = array())
{
// does the route need parameters? if so, we can't add it
// If the route needs additional parameters, we can't add it
try {
return $this->router->generate($name, array(), UrlGeneratorInterface::ABSOLUTE_URL);
return $this->router->generate($name, $params, UrlGeneratorInterface::ABSOLUTE_URL);
} catch (MissingMandatoryParametersException $e) {
throw new \InvalidArgumentException(
sprintf(
'The route "%s" cannot have the sitemap option because it requires parameters',
$name
'The route "%s" cannot have the sitemap option because it requires parameters other than "%s"',
$name,
implode('", "', array_keys($params))
)
);
}
Expand Down