Re: Structures_DataGrid

From: Date: Wed, 28 Jun 2006 14:32:58 +0000
Subject: Re: Structures_DataGrid
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24501@lists.php.net to get a copy of this message
Markus, Olivier Guilyardi wrote:
Markus Ernst wrote:
I try to use Structures_DataGrid for importing Data of various formats. So, after successfully bind()ed the data I would like to get them out as an array with the same structure as used for filling the Array datasource driver. As I did not find some kind of getRecordSet() method in DataGrid, I wonder what would be the appropriate way to get the data out:
Please post a feature request. I think we can safely add a getRecordSet() method or create an array renderer. You're not the first to ask that sort of feature, if I remember correctly.
2. Write a new renderer that returns the data as an array
You can do that, yes : subclass SDG_Renderer, "merge" $_columns and $_records in buildBody(), and return the resulting array with getOutput(). Shouldn't be much more than 10 lines.
Actually, there's a much better way, just use the DataSource directly. For example with XML : $datasource = new Structures_DataGrid_DataSource_XML(); $datasource->bind($xml); $data = $datasource->fetch(); DataGrid's DataSource layer provide a common interface for retrieving tabular data from all sort of formats/backends/etc... And you can use DataSource::sort() and DataSource::count() with all of them. In this regard, I think it's similar to SDO : http://pecl.php.net/package/sdo (although I never tried it) -- og

« previous php.pear.general (#24501) next »