I would like to decorate every controller action that I have in my project. I would like to start a custom logger engine and stop it every time an action method is called.
Like this:
class HomeController
{
public function indexAction()
{
Logger:start();
someLogicInThere();
...
Logger:end();
}
}
I would like to automate that extending to some class or something like this.
My final class controller will look like this:
class HomeController extends ControllerDecorator
{
public function indexAction()
{
someLogicInThere();
...
}
}
BTW: the logger stuff doesn't really matter. My question is more a design pattern issue
Any great idea?
Aucun commentaire:
Enregistrer un commentaire