Re: DB_DataObject and PHP5
| From: | Craig Ambrose | Date: | Thu, 07 Oct 2004 23:45:03 +0000 |
| Subject: | Re: DB_DataObject and PHP5 | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14807@lists.php.net to get a copy of this message | ||
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.
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
--
Craig Ambrose
Freelance Web Developer
http://www.portallus.com/people/craigambrose/