Re: Package proposal: DataObjectOnSpeed (naming is discussable :-))
| From: | Markus Wolff | Date: | Wed, 23 Jul 2003 09:57:26 +0000 |
| Subject: | Re: Package proposal: DataObjectOnSpeed (naming is discussable :-)) | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18573@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
Just one thought.. - would it be better to use a wrapper pattern on this rather than just straight extension. $do = DB_Dataobject::factory('mytable'); $x = new DB_DataObject_QuickForm($dataobject,array(Technically, I don´t see a problem in doing it the way you described - although it would have the disadvantage of having to make a lot of properties and methods publically visible, where a 'protected' approach would otherwise be sufficient. In other words, encapsulation might suffer. Right now this is not of much concern, but with PHP5 on the horizon... I´ll think about it some more and will make a list of things that would always have to be public, so we can see a little better what this would implicate. Regards, Markus'target' => '_self', 'method' => 'post'); $form = $x->getForm(); where the constructor does: function DB_DataObject_QuickForm(&$do,$options) {$this->dataObject = $do; $this->options = $options;} you can always use function &_generateForm($options){ global $_DB_DATAOBJECT; include_once ("HTML/QuickForm.php"); $do = &$this->dataObject;to prevent having to type $this->dataObject each time.. This would make it totally neutral of adding to the inheritance tree.. and follows DB_DataObjects kind of unwritten rule of not having more than 3 arguments to a method.