Re: Datagrid
| From: | Mark Wiesemann | Date: | Tue, 19 Sep 2006 21:18:48 +0000 |
| Subject: | Re: Datagrid | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25173@lists.php.net to get a copy of this message | ||
Chris Boget wrote:
> Datagrid is described as a "Datasource driver using PEAR::DB_DataObject".
>
> I've run the createTables.php script to create interface classes to my MySQL
> tables, all of which are child classes of DB_DataObject.
>
> Is there any way to 'merge' the two together such that your
> Structures_DataGrid() object uses my table interface object? Currently my
> code looks like this:
>
> $datagrid = new Structures_DataGrid();
> $result = $datagrid->bind( 'SELECT * FROM MyTable' );
> echo $datagrid->getOutput( DATAGRID_RENDER_XML );
>
> and that pretty much does what I want (in a very simplistic way). Is there
> any way that I can bind my table interface object to the datagrid (or vice
> versa) such that the result set datagrid uses is whatever is returned from
> one of my interface object's (custom) methods?
I'm not sure whether I get your question right, but bind() accepts
various types of inputs. One type is a query string (like in your
example), another one is a DB_DataObject instance (which seems to be
what you want to have).
You can find more information about SDG & DBDO in a tutorial from
Olivier: http://www.samalyse.com/code/pear/dgdo/
Regards,
Mark