Re: Structures_DataGrid and DB_DataObject
| From: | Andrew Nagy | Date: | Mon, 15 Nov 2004 20:13:13 +0000 |
| Subject: | Re: Structures_DataGrid and DB_DataObject | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15542@lists.php.net to get a copy of this message | ||
Michiel,
I apologize for the manual being incorrect. The manual is setup for version 0.6.0 which should be released very soon (I am awaiting my new Internet connection to be setup in my new house).
SDG 0.6.0 has a new data source management layer that allows much easier handling of various data types including DB_DO.
Until the new version is released (you can currently fetch it from CVS) you will need to use the db_dataobject->toArray() method to convert your dataobjects to arrays.
You can do the following:
$dg->addRecord(new Structures_DataGrid_Record_DataObject($do));or
$dg->addRecord(new Structures_DataGrid_Record($do->toArray()));In version 0.6.0 all you will need to do is use the bind method to the $do before the fetch, for example:
$do = new DataObject();
$dg->bind($do);
$dg->render();
SDG will then do the fetching and sorting for you. The code in CVS is very close to being released, so it should work for you.
Enjoy!
Andrew
Michiel Van Der Blonk wrote:
Hi I am trying to get the DataGrid and DataObject to work together. However, there is no data after performing the code. The datagrid doesn't even have the table columns. Any thoughts? According to the manual this should already work: $person =& new CM_PERSON(); $dg = new Structures_DataGrid(); $dg->bind($person); $dg->render(); BTW: CM_Person is a subclass of DB_DataObject BTW2: When I use the datagrid with an array I do get results. Also my DB_DataObject classes work fine. Michiel