Re: Re: DB_DataObjects save method
| From: | Alan Knowles | Date: | Sat, 30 Oct 2004 00:42:59 +0000 |
| Subject: | Re: Re: DB_DataObjects save method | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34174@lists.php.net to get a copy of this message | ||
you have to be carefull refering do DBDO - as the new C version does know the difference between fetched and assigned data, as it uses php's internal overload for __set/__get/__print_r etc.
so doing replaceInto should be alot simpler.
for dataobjects, it's probably worth doing
if (... not sequence key set... ) {
$this->insert()
}
$x = new __CLASS__;
$x->get(...sequence key ...);
$this->update($x);
Regards
Alan
Justin Patrin wrote:
On Fri, 29 Oct 2004 17:33:54 -0400, Hans L <hans@velum.net> wrote:I agree that enforcing set/get would make things much cleaner and be more of a "real" OO concept. DO left behind the "simple container for data" idea *long* ago.Ahh ... well, a good argument for why mutator methods are a good idea. Alan & I have already disagreed on that :)Another option here (again, a Propel thing, sorry) is to just store the columns that change. I'm trying to remember ... doesn't DBDO use the overload methods __set() and __get() to store the db info? So I guess in those methods you could store the modified columns (?).Only when you use it. It also allows direct setting/getting esp. for those of us on PHP4 where overloading either crashes PHP or breaks pass-by-ref. This simply would not work unless DO enforced this method of doing things.