phpbb-extensions/ad-management

Refactor admin controller

senky opened this issue · 1 comments

senky commented

Admin controller is becoming dangerously big. I am thinking of ways to refactor it. One solution might be creating a separate classes for every form field. Each such class would request a variable, validate inputted data and prepare it for display in the template. This way, we could potentially keep admin controller untouched when adding new fields. What do you think?

That would be a lot of classes. You could have one stand alone class for inputting/validating all the data, separate from the ACP controller. I would also consider an ACP manager or helper class. It could probably hold most of the protected stuff currently in the controller. Try to make the controller be dedicated only to the actual controller methods related directly to the modes (add, edit, delete, etc.).