Home » Structures » Structures_DataGrid » Bug #4874
DB_DataObject getter function naming problem
Details
| Submitted | 2005-07-21 07:39 UTC |
|---|---|
| From | evt at infoware dot com dot au |
| Assigned | asnagy |
| Status | Closed |
| Package | Structures_DataGrid |
| PHP Version | 5.0.3 |
| OS | Suse Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-07-21 07:39 UTC] evt at infoware dot com dot au
Description:
------------
DB_DataObject generator names setter/getter function with the column name, and sets the first letter to uppercase, eg. menus_id_pf is named getMenus_id_pf(). In the module DataSource/DataObject.php this is not taken into consideration, ie it tries to call getmenu_id_pf instead of getMenus_id_pf. Also the call is missing ().
Test script:
---------------
foreach ($fieldList as $fName) {
$getMethod = 'get'.$fName;
if (method_exists($this->_dataobject, $getMethod)) {
//$rec[$fName] = this->_dataobject->$getMethod(&$this);
$rec[$fName] = $this->_dataobject->$getMethod;
} elseif (isset($this->_dataobject->$fName)) {
$rec[$fName] = $this->_dataobject->$fName;
} else {
$rec[$fName] = null;
}
}
Should be (modified line with ***):
foreach ($fieldList as $fName) {
$getMethod = 'get'.ucfirst($fName); // ***
if (method_exists($this->_dataobject, $getMethod)) {
//$rec[$fName] = this->_dataobject->$getMethod(&$this);
$rec[$fName] = $this->_dataobject->$getMethod(); //***
} elseif (isset($this->_dataobject->$fName)) {
$rec[$fName] = $this->_dataobject->$fName;
} else {
$rec[$fName] = null;
}
}