Re: DB_DataObject and the set*(), get*() functions

From: Date: Tue, 28 Feb 2006 02:11:13 +0000
Subject: Re: DB_DataObject and the set*(), get*() functions
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23152@lists.php.net to get a copy of this message
On 2/27/06, Chris Boget <chris.boget@wild.net> wrote: > How is it that these function are working as they do? They aren't defined > in either the child or parent classes. In reading the docs, I think I > understand correctly that it is being handled by some overloading mechanism > (how, exactly?) utilizing the _call() method (is that right?). But in > looking at the DB_DataObject's parent class (DB_DataObject_Overload, I think > it is? I can't remember off the top of my head), it looks like that class > is defining the _call() method but it also looks to be calling itself (ie, > this->_call()) in processing the data. Am I reading that wrong? > > In any case, if someone could explain exactly how the set*() and get*() > methods are working when not defined, I would be very appreciative! > This is implemented through PHP's overloading feature and is handled through the __call method. If you're using PHP4 stop now and turn off overloading: define('DB_DATAOBJECT_NO_OVERLOAD', 1); overloading in PHP4 is broken (it breaks implicit pass-by-reference in method calls). And no, it's not calling itself. Note the extra underscore (_). __call is the method PHP calls. _call is an internal method on the DB_DO class which does the real work. -- Justin Patrin

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