I'm creating an application with Symfony 2.3.5 to manage my music. I have some problems to configure my routes.
I want to create 3 routes :
/music/mickael_jackson
/music/mickael_jackson/edit
/music/mickael_jackson/thriller
As you can show, there will be a conflict between routes for 'Edit Artist' and for 'Show album' : 'Edit Artist' is catched as the 'Show album route' and give me a 404 not found.
I'm trying to use regular expressions to exclude keywords edit
and delete
from route 'Show album'.
I have found one here : A regular expression to exclude a word/string (Accepted answer with a little change), but it doesn't work, I have an error because my route 'Show album' did not match regex.
Exception :
An exception has been thrown during the rendering of a template ("Parameter "nameCanonical" for route "corum_music_album_show" must match "/(?!edit|delete)" ("beneath_the_encasing_of_ashes" given) to generate a corresponding URL.") in CorumMusicBundle:Artist:show.html.twig at line 36.
My route :
* @Route(
* "{artistNameCanonical}/{nameCanonical}",
* name = "corum_music_album_show",
* requirements={"nameCanonical" = "^/(?!edit|delete)$"},
* options = {"expose"=true}
* )
I can't find what's wrong in the configuration.
Thanks for help.
use this pattern ^(?!.*(edit|delete)$).*
I don't know Symfony either
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With