Friday, August 3, 2012

ZF2's New Controller::init() - Matthew Weier O'Phinney

ZF2's New Controller::init() - Matthew Weier O'Phinney:
In Zend Framework 1, controller's had an init()
method, which was called after the controller was instantiated. The
reason for it was to encourage developers not to override the
constructor, and thus potentially break some of the functionality
(as a number of objects were injected via the constructor).
init() was useful for doing additional object
initialization.

class MyController extends Zend_Controller_Action
{
    public function init()
    {
        // do some stuff!
    }
}

But this feature is missing from ZF2; how can we accomplish this
sort of pattern?

DIGITAL JUICE

No comments:

Post a Comment

Thank's!