I have been working in Zend Framework for a while and I am currently refactoring some parts of my code. One of the big thing I would like to eliminate is my abstract
controller class which initiate a lot of variables which must be present in all my controller such as $success
, $warning
and $error
. This part can be done in controller pluggins but what would be the best way to send these variables to the related view. Currently I am using a custom method in my abstract
controller class which i call from within all my controllers.
protected function sendViewData(){
$this->view->success = $this->success;
$this->view->warning = $this->warning;
$this->view->error = $this->error;
}
which is then called in all the actions of all of my controllers throught
parent::sendViewData();
I was looking to automate this process through a plugin controller or anything better suited for this