你知道为什么在 Symfony (5.3) 中会发生这种情况吗?
例如,我有一个这样声明的路线:
offer.create:
controller: Offer\Infrastructure\UI\Controller\GetEntityController
methods: [ GET ]
path: '/my-entity/{myEntityId}'
这是控制器动作:
public function __invoke(Request $request, string $myEntityId): Response
{
echo $myEntityId;
这就是我所说的:(/my-entity/7f316daa-c025-41cf-b1c4-756dbc7e4e1d
使用典型的 uuid 字符串)。
在这种情况下,那里的回声将显示7
,或者如果 uuid 以字母开头,它将显示一个“0”,就好像它正在转换为 int 路径参数。
或者,如果我不输入路径参数:
public function __invoke(Request $request, $myEntityId): Response
{
echo $myEntityId;
然后 echo 将整个 uuid 正确地显示为字符串。
你知道为什么会这样吗?我在某处缺少一些配置?