Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
c2421fab
Commit
c2421fab
authored
Nov 07, 2013
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed the flush call in the url generator service
parent
5f9716d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
doc/providers/url_generator.rst
doc/providers/url_generator.rst
+8
-0
src/Silex/Provider/RoutingServiceProvider.php
src/Silex/Provider/RoutingServiceProvider.php
+0
-2
No files found.
doc/providers/url_generator.rst
View file @
c2421fab
...
...
@@ -64,6 +64,14 @@ Moreover, if you have ``twig-bridge`` in your ``composer.json``, you will have a
{{ path('hello', {name: 'Fabien'}) }}
{{ url('hello', {name: 'Fabien'}) }} {# generates the absolute url http://example.org/hello/Fabien #}
.. warning::
If you try to use the ``url_generator`` service outside the handling of a
request, you must explicitly flush routes first::
$app->flush();
$url = $app['url_generator']->generate('homepage');
Traits
------
...
...
src/Silex/Provider/RoutingServiceProvider.php
View file @
c2421fab
...
...
@@ -30,8 +30,6 @@ class RoutingServiceProvider implements ServiceProviderInterface, EventListenerP
public
function
register
(
\Pimple
$app
)
{
$app
[
'url_generator'
]
=
$app
->
share
(
function
(
$app
)
{
$app
->
flush
();
return
new
UrlGenerator
(
$app
[
'routes'
],
$app
[
'request_context'
]);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment