I am building an application with Symfony 2.3.5 to control my music. I'm having trouble setting up routes.
I want to create 3 routes:
- Show artist:
/music/mickael_jackson - Edit Artist:
/music/mickael_jackson/edit - Show album:
/music/mickael_jackson/thriller
As you can show, there will be a conflict between the routes for "Edit Artist" and "Show Album": "Edit Artist" is set to "Show Album Route" and give me 404 not found.
I'm trying to use regular expressions to exclude keywords editand deletefrom the route "Gallery".
I found here: Regular expression to exclude a word / line (accepted answer with a little change), but it does not work, I have an error because my "Show album" route does not match the regular expression.
An 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 not find what is wrong in the configuration.
Thanks for the help.
source
share