Re: DB_DataObject's class generator
| From: | Torsten Roehr | Date: | Sun, 12 Dec 2004 21:15:46 +0000 |
| Subject: | Re: DB_DataObject's class generator | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16193@lists.php.net to get a copy of this message | ||
"Justin Patrin" <papercrane@gmail.com> wrote in message
news:432beae04121212106591d456@mail.gmail.com...
> On Sun, 12 Dec 2004 15:27:57 +0100, Torsten Roehr <roehr@zilleon.com>
wrote:
> > "Alan Knowles" <alan@akbkhome.com> wrote in message
> > news:41BBC524.3090308@akbkhome.com...
> >
> >
> > > I've had a few offers of patches to convert to private +
setter/getters
> > > - but none have been posted yet. :)
> > >
> > > I think the generator in cvs supports writing privates, but I havent
> > > looked at it for a little while.
> > >
> > > There is a slight complication, as the joinAdd + links code will very
> > > likely have to be changed, as they read/write from other objects.
> > >
> > > Regards
> > > Alan
> >
> > Hi Alan,
> >
> > thanks for your response. As you seem interested I will try to add a
> > buildGetters() method on top of the current CVS version next week. The
use
> > should be optional and default to false, so we need another option like
> > 'buildGetters' => true.
> >
> > I won't touch the property declarations but maybe in the future they
could
> > be reformatted with a proper docblock. I will include docblocks in the
> > getter declarations. IMHO it doesn't make sense to auto-generate
setters -
> > most developers will customize them anyway to include sanitization and
> > validation of the input values so they should not be part of the
> > auto-generated part of the class.
> >
> > What do you think (also regarding the name of the method and the
option)?
> >
>
> I think that setters *should* be auto-generated along with getters.
> Getters aren't really useful unless you have setters. I thought the
> point of this option was to make a "private member vars" ready DO? The
> dev just has to alter the parts of it that need different validation.
>
> --
> Justin Patrin
Hi Justin,
it's no problem to also add a method to write the setters. But I see
potential conflicts with altered methods - unless they are manually moved
out of the auto-generated part the changes will get lost if the class
generator is run again. This is something the developer should be made aware
of.
I'll wait for Alan's response. Thanks for your remarks, Justin.
Regards, Torsten