Re: DB_DataObject and Structures_DataGrid integration

From: Date: Fri, 13 Aug 2004 20:09:21 +0000
Subject: Re: DB_DataObject and Structures_DataGrid integration
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32653@lists.php.net to get a copy of this message
On Fri, 13 Aug 2004 20:52:27 +0200, Olivier Guilyardi <ml@xung.org> wrote: > Justin Patrin wrote: > > On Fri, 13 Aug 2004 19:47:14 +0200, Olivier Guilyardi <ml@xung.org> wrote: > > > >>So I guess that the developer has to directly do : > >> > >>$datasource = new Structures_DataGrid_Source_DataObject($dataobject); > >> > >>Is that right ? > >> > > > > > > If this is so, I'd like to propose something else. It would be best > > IMHO to have the data sources auto-included and created for us. Such > > as: > > $dg->bindDataSource('dataObject', $do); > > > > the bind() method can instantiate the right kind of datasource. This is > about two lines of code... Now, for some advanced features, one may need > to create a DG_Source object before adding it to the datagrid. > > Why passing a such additionnal 'dataObject' parameter ? is_subclass_of() > is everything we need. Some other sources can be parsable strings. > The 'dataObject' is an identifier for the backend. Yes, it can be done through is_subclass_of, but others expressed that if you add lots of data sources, you have a huge if/else in bind(). You also have to change it every time you add a new data source. Think of this like DB::connect() which forces you to specify your DB type. Then it auto-loads and instatiated the backend you need. IMHO, DG should use somehting similar so as not to create an adminstration nightmare in bind() and to save extra processing time in bind(). -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.pear.dev (#32653) next »