Re: SDG Datasource DB_Dataobject
| From: | Olivier Guilyardi | Date: | Mon, 25 Feb 2008 12:29:12 +0000 |
| Subject: | Re: SDG Datasource DB_Dataobject | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28570@lists.php.net to get a copy of this message | ||
Hi,
Mads Lie Jensen wrote:
I'm using Structures_Datagrid to display some data, using the DB_DataObject-datasource. However, there is one thing which puzzles me. I have in my database some columns with underscores in their names: dansk_navn, latinsk_navn If I then have a getter in my DataObject called getDansk_navn(), it is _not_ called by the datasource when getting data. But if I call it getDanskNavn(), it gets called to fetch the data of dansk_navn. Looking in the source of the DB_DataObject-datasource, it seems intentional that it will strip of any _ when using getters. If no getter is present, it will still get the correct data of the dansk_navn-property. Why is it like this? is it a bug?Yes, that sounds like a bug. It looks like we misunderstood Dataobject's automatic getters and setters. In some other ORMs, my_sql_field gets wrapped by a clean getMySqlField() method, and that may have confused us. Dataobject seems to create a method named getMy_sql_field(). That's quite an odd name, but anyway SDG should be compatible with it (we'll certainly retain BC with the current behaviour though). Please post a bug report at: http://pear.php.net/bugs/report.php?package=Structures_DataGrid_DataSource_DataObject Regards, -- Olivier