Re: Structures_DataGrid question - do I need to use DB_DataObject?

From: Date: Thu, 17 Nov 2005 15:01:57 +0000
Subject: Re: Structures_DataGrid question - do I need to use DB_DataObject?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21964@lists.php.net to get a copy of this message
l Burnerheimerton wrote: > Most examples I see for Structures_DataGrid also use > DB_DataObject. Is that coincidence, a requirement or > just common usage? This is no requirement at all. Actually, it comes from the design history of Structures_DataGrid. My original idea was to couple DB_DataObject and Structures_DataGrid, which led me to code the Structures_DataGrid_DataSource layer. This layer has been driver-based since the beginning, and now has many other drivers, DB_DO being only one of them. For example I'd recommend you take a look at Mark's DBQuery smart and ligthweight driver (in CVS). You should also read the comments at the top of DataGrid/DataSource.php, to learn how to write drivers for your own needs. It is pretty easy. For example, if you want maximum optimization (eg: avoid DB), you can write a driver that directly calls mysql_* function (and use any mysql built-in functions if you like that). That shouldn't be more than 20/30 lines. Writing your own optimized drivers is pretty neat IMHO. You may also write you own lightweight DataObject implementation, and pass it to the bind() method (you'll need to force the type with the third argument). Structures_DataGrid actually is : a Controller. You can provide custom Model classes (DataSources), and when req #5859 is over you should be able to provide custom View classes (Rendererers). -- og

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