Re: DataObject datasource for DataGrid
| From: | Justin Patrin | Date: | Sun, 09 Jan 2005 20:50:34 +0000 |
| Subject: | Re: DataObject datasource for DataGrid | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16849@lists.php.net to get a copy of this message | ||
On Sun, 9 Jan 2005 22:22:02 +1100, electroteque <daniel@electroteque.org> wrote:
> Hi , I have discovered a huge problem with the DataObject datasource
> for DataGrid, one being that some bug for the toArray method is not
> fixed so its returning all the object vars and using them as the
> columns ! Here is what i found
What do you mean you discovered it? The DataGrid author did this to
"fix" the join bug. Of course, I didn't realize this in my patch....
>
> // Can't use this until DB_DO Bug 1315 is fixed
> //$rec = $this->_dataobject->toArray());
>
> // REPLACE ME WITH ABOVE
> $rec = get_object_vars($this->_dataobject);
>
> its getting all the vars from the object and returning them as columns
> fuk
>
> so in my DO's
>
> var $__table = 'users'; // table name
> var $_database = 'thedb';
>
> these become the columns !
>
> What can i do ?
>
You can set the columns manually or alter the DataGrid to use table()
instead (as I did). Or you can uncomment the toArray() method, it will
probably also work as long as you're not joining.
--
Justin Patrin