Re: DB_DataObject and Structures_DataGrid integration
| From: | Andrew Nagy | Date: | Wed, 11 Aug 2004 13:49:53 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32548@lists.php.net to get a copy of this message | ||
Olivier Guilyardi wrote:
Let's take :Well since I have worked with many of Markus Wolff's ideas when planning and designing the DataGrid, I do like his ideas. The DG, in my mind, is a layer between the interface and the datasource. However, The DG has "drivers" (or whatever you want to call them) for the interface and datasource. I personally would like to see more development in the datasource driver department. As to the "bind" method, the goal of it is to do what I like to call "Quick and Dirty" action. Someone can simply take a 2D Associative array and call the bind method and then call the render method and have a full DG in only a few lines of code. I would be interested in seeing more options (as Markus suggested) in the bind method; however, I feel that there should be more "drivers" for different datasources. If you feel that you would like to propose a new PEAR package to join multiple packages (which I don't like and could probably say I am guilty of with DG) I would do something like the DataObject front end that has many drivers for different front-ends, not just one. As to the FormBuilder, I apologize for not knowing more about it. I have spent very little time with this package and would like to inspect it more. But I am still confused why Structures_DataGrid_Record_DataObject is not meeting your needs? Why would you want to bind an array of DataObjects when you can do something like the following: $user = new User(); if ($user->find) {$datagrid->bind($dataobject);This is the same as setDataSource(), as Markus Wolff proposed. It also is the .NET way. Additionally, it's a very clear statement : "bind" says it all. This bind() function currently accepts a simple array, and as Markus said, with some get_class($arg) it is very easy to make it accepts anything. But the DataGrid code is just too nice, I don't dare to touch it. I would need to heavily modify it, because nothing is ready for bind() to support bilateral interactions : it currently reads an array, I need it to read a DataObject but also to instruct it how to sort and limit the data.
while ($user->fetch()) {
$dg->addRecord(new
Structures_DataGrid_Record_DataObject($user));
}
}
or even:
$user = new User();
if ($user->find) {
while ($user->fetch()) {
$dg->addRecord($user->toArray());
}
}
I do urge you or others to help contribute to Structures_DataGrid!
Thanks
Andrew