Skip to content

Commit 901249f

Browse files
committed
minor #17068 [HttpKernel] Add UidValueResolver to the list of built-in value resolvers (ker0x)
This PR was merged into the 6.1 branch. Discussion ---------- [HttpKernel] Add UidValueResolver to the list of built-in value resolvers Closes #16542 Commits ------- 6474f57 [HttpKernel] Add UidValueResolver to the list of built-in value resolvers
2 parents edb8b47 + 6474f57 commit 901249f

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

controller/argument_value_resolver.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,32 @@ Symfony ships with the following value resolvers in the
115115
Will set the default value of the argument if present and the argument
116116
is optional.
117117

118+
:class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\UidValueResolver`
119+
Attempts to convert any UID values from a route path parameter into UID objects.
120+
Leads to a 404 Not Found response if the value isn't a valid UID.
121+
122+
For example, the following will convert the token parameter into a ``UuidV4`` object::
123+
124+
// src/Controller/DefaultController.php
125+
namespace App\Controller;
126+
127+
use Symfony\Component\HttpFoundation\Response;
128+
use Symfony\Component\Routing\Annotation\Route;
129+
use Symfony\Component\Uid\UuidV4;
130+
131+
class DefaultController
132+
{
133+
#[Route('/share/{token}')]
134+
public function share(UuidV4 $token): Response
135+
{
136+
// ...
137+
}
138+
}
139+
140+
.. versionadded:: 6.1
141+
142+
The ``UidValueResolver`` was introduced in Symfony 6.1.
143+
118144
:class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\VariadicValueResolver`
119145
Verifies if the request data is an array and will add all of them to the
120146
argument list. When the action is called, the last (variadic) argument will
@@ -137,7 +163,7 @@ PSR-7 Objects Resolver:
137163
Injects a Symfony HttpFoundation ``Request`` object created from a PSR-7 object
138164
of type :class:`Psr\\Http\\Message\\ServerRequestInterface`,
139165
:class:`Psr\\Http\\Message\\RequestInterface` or :class:`Psr\\Http\\Message\\MessageInterface`.
140-
It requires installing :doc:`the PSR-7 Bridge </components/psr7>`_ component.
166+
It requires installing :doc:`the PSR-7 Bridge </components/psr7>` component.
141167

142168
Adding a Custom Value Resolver
143169
------------------------------

reference/forms/types/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
1313
+---------------------------+-----------------------------------------------------------------------------+
1414
| Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) |
1515
+---------------------------+-----------------------------------------------------------------------------+
16-
| Rendered as | single text box or five select fields |
16+
| Rendered as | single text box or five select fields |
1717
+---------------------------+-----------------------------------------------------------------------------+
1818
| Default invalid message | Please enter a valid date and time. |
1919
+---------------------------+-----------------------------------------------------------------------------+

0 commit comments

Comments
 (0)