Re: DB_DataObject and PHP5

From: Date: Fri, 08 Oct 2004 01:54:55 +0000
Subject: Re: DB_DataObject and PHP5
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14809@lists.php.net to get a copy of this message
On Fri, 8 Oct 2004 09:45:03 +1000, Craig Ambrose <craiga@webelements.com.au> wrote: > > On that note, I was just thinking that it would be great if there some extra > configuration parameters. > > - One which made it generate all the table field data members as "private" > instead of public. > - One which causes it to automatically generate getter methods for the field > data members. > - One which causes it to automatically generate setter methods for the field > data members. > > So, with all three on it would look like this (ignore formatting): > > ... > private $title; // blob(255) not_null blob > ... > > public getTitle() {return $this->title;} > public setTitle($new_value) {$this->title = $new_value;} > > I think that this would be usefull to many people. As my PHP application goes > larger, I find I'm wanting to return to stricter access protection which I > traditionally used in languages like C++, in order to better ensure that my > app remains nice and modular (and it helps with unit testing). > > If Denis doesn't get in first, I can probably submit a patch for this in a > week or two. Sounds good, except that the overloading is supposed to handle get/set methods which are not actually defined (see the _call method). You're supposed to leave it to do all of the stuff you don't want to make specific funcitons for. > > Craig > > On Fri, 8 Oct 2004 2:42 am, Justin Patrin wrote: > > > That is OK for PHP4 but PHP5 classes should use another syntax like this > > > (I use PHP5.): > > > > > > ... > > > private $__table = 'contents'; // table name > > > public $id; // int(10) not_null primary_key unsigned > -- paperCrane --Justin Patrin--

« previous php.pear.general (#14809) next »