Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Bug #4874 DB_DataObject getter function naming problem
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)    
Subscription  


 [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; } }

Comments

 [2005-07-26 18:59 UTC] asnagy
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.