i have a complex form. This form is created in the controller A. All actions, like: edit, add, load, index are in the controller A defined and the method actionIndex is essential for all other requests.
Like this schema:
public class controllerA {
function actionIndex(Requerst r){
r.handleRequest();
if ($form->get('index')->isClicked()){
// Index Action
}
if ($form->get('add')->isClicked()){
$this->actionAdd();
}
// ...
}
function actionAdd(){}
}
}
How do i seperate the requests in different controllers? Actually it doesnt feel good.
Here my actual code of the controller: http://pastebin.com/HuXhV37q
I have skimmed through your code and I speak german so I understand it.
It would be too much to cover here so I just give you some "keywords".
Outsource business logic from controllers to symfony services to keep the controllers light. ($zusaetzeArray etc.)
Create Entities and FormTypes for the form data if it makes sense economically.
Create multiple controller actions with corresponding routes for the different form states.
Symfony2 Service: https://stackoverflow.com/a/13099900/982075