Default action for sfDoctrineRouteCollection
I'm using Symfony's admin generat开发者_运维知识库or and on the whole everything is working as I would like.
However, I'd like to know if there is an easy way to set the default action for a module. The generator sets up routes using sfDoctrineRouteCollection by default.
For a specific module, I would like the default action to be "new" rather than "index" but still have the links like "back to list" work correctly.
By easy I mean a generator configuration option or something like that, I have checked the documentation but no luck yet.
Thanks everyone
OK i have never done this and i am not sure i would but as everything that runs as the ./symfony command is written in symfony (according to Fabien) so you can leverage it you go to ......
lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/
there you will find a set of templates that comprise the CRUD that is built when you generate and i assume altering those or the code that uses those will give you what you want.
(Note i see you specified Admin Generator i assume this is the code for that as well as the frontend. If not you might need to hack in that are a bit more.)
Just expanding on your comment. I agree with you the yaml would be better. Above was my sledgehammer approach. However is the structure is hardwired in those templates then the yaml approach, at the moment, wouldn't work as it has no variables to control. One would need to take the hardwiring out of those templates and move them to a yaml file and then it will work. However as Symfony2 is close to release it's perhaps not worth it unless it's quick. However could be in S2 if it works in the same/similar way
精彩评论