symfony2admingenerator/GeneratorBundle — pull request #77 by ksn135 (2014-12-18 07:35:09+00:00)
Title: [Feature] Add default action after save

This PR allow to configure globally (in config.yml) or locally (in module generator.yml) default action to redirect user after successfully create or update entity. IMHO, it's very useful missed option.
You don't need to specify manually for each action (edit and new) in each module ```save-and-add: ~``` or ```save-and-list: ~``` parameters.
Also you could redirect user to show action. It was not possible before.
More than that, you can even redirect user to new custom URL, generated via your own function.
***There is NO BC. By default admingenerator behaviour is NOT changed.***

If you wanna set by default that all your object after save redirect to list action than you must set parameter ```default_action_after_save ``` in config.yml file:
```
admingenerator_generator:
default_action_after_save: list
```
You can change this default on per module basis via ```actionAfterSave``` parameter:
```
generator: admingenerator.generator.doctrine
params:
actionAfterSave: show
```
Or even more. For example, you have special action ```report```. And after save your entity you want to see some changes in that module.
At first, you create custom url generator function in your controller:
```
/**
* Get report URL
*
* @return string
*/
protected function getReportUrl($pk)
{
return $this->generateUrl("my_custom_route", array('id' => $pk, 'model' => 'Param' ) );
}
```
And then you set in your module generator.yml parameter ```actionAfterSave``` to ```report```:
```
generator: admingenerator.generator.doctrine
params:
actionAfterSave: report
```
After user has successfully saved object he will be redirected to special report via generated url.