8000 Unify URL generator reference type + make linking in php templates consistent with twig by Tobion · Pull Request #16276 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Unify URL generator reference type + make linking in php templates consistent with twig #16276

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

Merged
merged 3 commits into from
Oct 19, 2015
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[Templating] introduce path and url methods in php templates to be in…
… line with twig templates
  • Loading branch information
Tobion committed Oct 18, 2015
commit 97d6828b51c7a3dd316a03d9a9b6d2a83b7481fd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,38 @@ public function generate($name, $parameters = array(), $referenceType = UrlGener
return $this->generator->generate($name, $parameters, $referenceType);
}

/**
* Generates a URL reference (as an absolute or relative path) to the route with the given parameters.
*
* @param string $name The name of the route
* @param mixed $parameters An array of parameters
* @param bool $relative Whether to generate a relative or absolute path
*
* @return string The generated URL reference
*
* @see UrlGeneratorInterface
*/
public function path($name, $parameters = array(), $relative = false)
{
return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
}

/**
* Generates a URL reference (as an absolute URL or network path) to the route with the given parameters.
*
* @param string $name The name of the route
* @param mixed $parameters An array of parameters
* @param bool $schemeRelative Whether to omit the scheme in the generated URL reference
*
* @return string The generated URL reference
*
* @see UrlGeneratorInterface
*/
public function url($name, $parameters = array(), $schemeRelative = false)
{
return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
}

/**
* {@inheritdoc}
*/
Expand Down
0