The symfony admin generator is one of the best features of the framework. With just a couple of commands and a few changes to a config file, you can have something pretty close to a database access interface. There’s a simple built in security module, and sfGuard is fairly simple to understand if you need a more complex security module.
At first it seems like the admin code is pretty much pre-baked, and there’s not much you can do to change the behaviour of the interface, save change the config files. But one of the most useful things to know about the symfony admin generator is that you can do extra things. It’s not well documented, but sticking this method:
protected function updateModuleNameFromRequest()
in your actions.class.php file allows you to add in extra code each time anything is done in that module (substitute ModuleName for your own module).
For example, if you need to clear the cache each time something is done, put it here. If you need to update a set of data in a one-to-many relationship with a class, put it here.
It seems curious that more is not made of this function in the book and documentation, because it’s so useful.
And don’t forget you can also use the standard executeAction() methods, preExecute(), postExecute(), etc. in your module’s action.class.php file, in exactly the way a frontend action would work. This means you can add in any kind of custom action to the admin section of your application.
Pingback: rpsblog.com » A week of symfony #72 (12->18 may 2008)
hi
please explain more about your post
thank you in advance
aditya
Heh
Well symfony 1.2 is going to have a much more powerful and advanced admin generator. I have no idea yet if updateModuleNameFromRequest() will work in 1.2.