Wednesday, December 19, 2012

Zend Framework 2 controller init

Example:

class MyController extends Controller {
protected $bInit = false;


public function onDispatch(\Zend\Mvc\MvcEvent $e) {
    if (! $this-> bInit) {
      $this->init();
      $this-> bInit = true;
    }
    return parent::onDispatch($e);
  }

No comments: