Re: Re: Datagrid and linking dataobjects
| From: | Justin Patrin | Date: | Thu, 20 Jan 2005 22:28:02 +0000 |
| Subject: | Re: Re: Datagrid and linking dataobjects | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17058@lists.php.net to get a copy of this message | ||
On Thu, 20 Jan 2005 15:57:11 -0600, Larry Garfield
<larry@garfieldtech.com> wrote:
> Justin Patrin wrote:
> > On Thu, 20 Jan 2005 09:01:36 -0800, Jamie Alessio
> > <Jamie.Alessio@ucop.edu> wrote:
> > [snip]
> >
> >>$obj1 = new DataObject_X;
> >>$obj2 = new DataObject_Y;
> >
> > [snip]
> >
> > OT: *Why* does everyone use new with DataObjects? Why not use
> > DB_DataObject::factory()?
>
> In my case, because for unknown reasons I get a class not found error
> returned whenever I use factory() but new works fine. And I've not yet
> figured out what if anything is the advantage of using one over the
> other. :-)
>
> What is the advantage of using factory() instead of new anyway?
>
The main advantage is not having to require_once() all of yout DO
class files. If you get a class not found error there's probably a
problem with your ini file or the way that you're loading it for your
scripts.
--
Justin Patrin