| Justin Patrin 2006-02-27, 9:57 pm |
| 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 define=
d
> in either the child or parent classes. In reading the docs, I think I
> understand correctly that it is being handled by some overloading mechani=
sm
> (how, exactly?) utilizing the _call() method (is that right?). But in
> looking at the DB_DataObject's parent class (DB_DataObject_Overload, I th=
ink
> it is? I can't remember off the top of my head), it looks like that clas=
s
> 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
|