Heim > Fragen und Antworten > Hauptteil
P粉1297318082023-08-29 19:01:43
DOC示例:
#[Route('/blog/{date}/{slug}/comments/{comment_slug}')] #[ParamConverter('post', options: ['mapping' => ['date' => 'date', 'slug' => 'slug']])] #[ParamConverter('comment', options: ['mapping' => ['comment_slug' => 'slug']])] public function showComment(Post $post, Comment $comment) { }
所以,在您的情况下,您必须有:
#[Route('/{slug}/{subSlug}', name: 'subcategory')] #[ParamConverter('cat', options: ['mapping' => ['slug' => 'slug']])] #[ParamConverter('sub', options: ['mapping' => ['subSlug' => 'slug']])] public function (Category $cat, Subcategory $sub): Response { }