Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97d6828

Browse files
committed
[Templating] introduce path and url methods in php templates to be in line with twig templates
1 parent912fc4d commit97d6828

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,38 @@ public function generate($name, $parameters = array(), $referenceType = UrlGener
4949
return$this->generator->generate($name,$parameters,$referenceType);
5050
}
5151

52+
/**
53+
* Generates a URL reference (as an absolute or relative path) to the route with the given parameters.
54+
*
55+
* @param string $name The name of the route
56+
* @param mixed $parameters An array of parameters
57+
* @param bool $relative Whether to generate a relative or absolute path
58+
*
59+
* @return string The generated URL reference
60+
*
61+
* @see UrlGeneratorInterface
62+
*/
63+
publicfunctionpath($name,$parameters =array(),$relative =false)
64+
{
65+
return$this->generator->generate($name,$parameters,$relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
66+
}
67+
68+
/**
69+
* Generates a URL reference (as an absolute URL or network path) to the route with the given parameters.
70+
*
71+
* @param string $name The name of the route
72+
* @param mixed $parameters An array of parameters
73+
* @param bool $schemeRelative Whether to omit the scheme in the generated URL reference
74+
*
75+
* @return string The generated URL reference
76+
*
77+
* @see UrlGeneratorInterface
78+
*/
79+
publicfunctionurl($name,$parameters =array(),$schemeRelative =false)
80+
{
81+
return$this->generator->generate($name,$parameters,$schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
82+
}
83+
5284
/**
5385
* {@inheritdoc}
5486
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp