2009/3/6 Sebastien Crocquesel <cortex93@gmail.com>
I also like the idea to inject by constructor, but I'm not sure if this will be a violation of LSP because the signature of __construct is different (but striclty compatible) than the parent one.
What I have done is simple. I just override the default constructor with mine. In it, i call the parent one.public __construct($myparam, $options){parent:__construct($options);// do someting with $myparam (database request to fill a Zend_Form_Select element for example).// this is code that i would have put in the controller when building the form if do not refactor in a Zend_Form subclass}
I also like the idea to inject by constructor, but I'm not sure if this will be a violation of LSP because the signature of __construct is different (but striclty compatible) than the parent one.
--
Giorgio Sironi
Piccolo Principe & Ossigeno Scripter
http://ossigeno.sourceforge.net
没有评论:
发表评论