Re: DB_DataObject: what am I missing?
| From: | Justin Patrin | Date: | Sun, 23 Jan 2005 20:11:23 +0000 |
| Subject: | Re: DB_DataObject: what am I missing? | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17112@lists.php.net to get a copy of this message | ||
On Sun, 23 Jan 2005 14:07:21 -0600, Larry Garfield
<larry@garfieldtech.com> wrote:
> Justin Patrin wrote:
>
> > The fix for this is:
> > define('DB_DATAOBJECT_NO_OVERLOAD', 1);
> > Set this before you include any DO files in any script. This may also
> > fix your other problem. IMHO this should be disabled by default
> > because overloading breaks pass-by-ref.
>
> The current bug aside, why are people so against overloading? Without
> the accessor/modifier methods, you have to access the data directly,
> which breaks encapsulation. (Yes, I happen to like OO concepts. <g>)
> You could just write them yourself (as you would have to in Java or many
> other languages), but then you're losing half of the point of using DBDO
> in the first place.
>
Because it breaks pass-by-reference. You have to use
call-time-pass-by-reference to get around it, and that's deprecated
and causes warnings. Getters and setters can be nice, but IMHO
overloading should not be used in PHP4 as it breaks things. It should
have been kept for PHP5 which does not have the same issues.
--
Justin Patrin