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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!