Home > Archive > PHP Pear > February 2008 > Re: [PEAR] SDG Datasource DB_Dataobject
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PEAR] SDG Datasource DB_Dataobject
|
|
| Olivier Guilyardi 2008-02-25, 8:08 am |
| 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 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...br />
ataObject
Regards,
--
Olivier
| |
| Mads Lie Jensen 2008-02-25, 7:09 pm |
| On Mon, 25 Feb 2008 13:29:12 +0100, ojaiml@nerim.net (Olivier Guilyardi)
wrote:
>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 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).
Strange name or not, if I have named my columns in the database
field_name, I would at first presume to use getField_name() to retrieve
it.
I rarely use _ in column-names now, but I'm working a bit with some old
data.
>Please post a bug report at:
>http://pear.php.net/bugs/report.php...br />
ataObject
Done: http://pear.php.net/bugs/bug.php?id=13199
--
Mads Lie Jensen - mads@gartneriet.dk - ICQ #25478403
Gartneriet - http://www.gartneriet.dk/
|
|
|
|
|