Skip to content

Commit 070c9bb

Browse files
committed
add a warning about object as extra parameter in route
1 parent 685cb2c commit 070c9bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

routing.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,14 @@ use the ``generateUrl()`` helper::
18801880
// the 'blog' route only defines the 'page' parameter; the generated URL is:
18811881
// /blog/2?category=Symfony
18821882

1883+
.. caution::
1884+
1885+
While objects are converted to string when used as placeholders, they are not
1886+
converted when used as extra parameters. So, if you're passing an object (e.g. an Uuid)
1887+
as value of an extra parameter, you need to explictly convert it to a string::
1888+
1889+
$this->generateUrl('blog', ['uuid' => (string) $entity->getUuid())]
1890+
18831891
If your controller does not extend from ``AbstractController``, you'll need to
18841892
:ref:`fetch services in your controller <controller-accessing-services>` and
18851893
follow the instructions of the next section.

0 commit comments

Comments
 (0)