cvs: pear /Structures_DataGrid/DataGrid/DataSource DataObject.php
| From: | Olivier Guilyardi | Date: | Fri, 09 Feb 2007 12:30:33 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid/DataSource DataObject.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44588@lists.php.net to get a copy of this message | ||
olivierg Fri Feb 9 12:30:33 2007 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid/DataSource DataObject.php
Log:
fix request #9803: Build proper method name for attributes with an underscore
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php?r1=1.40&r2=1.41&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php
diff -u pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.40
pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.41
--- pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.40 Fri Feb 9 11:54:17 2007
+++ pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php Fri Feb 9 12:30:33 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: DataObject.php,v 1.40 2007/02/09 11:54:17 olivierg Exp $
+ * CSV file id: $Id: DataObject.php,v 1.41 2007/02/09 12:30:33 olivierg Exp $
*
- * @version $Revision: 1.40 $
+ * @version $Revision: 1.41 $
* @package Structures_DataGrid_DataSource_DataObject
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php
New BSD License
@@ -64,7 +64,7 @@
* 'fields' option. If the 'fields' option is
set,
* this one will not be used.
*
- * @version $Revision: 1.40 $
+ * @version $Revision: 1.41 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Andrew Nagy <asnagy@webitecture.org>
* @access public
@@ -248,9 +248,11 @@
// Build DataSet
$rec = array();
foreach ($this->_options['fields'] as $fName) {
- $getMethod = 'get' . ucfirst($fName);
+ $getMethod = (strpos($fName, '_') !== false)
+ ? 'get' . implode('', array_map('ucfirst',
+ explode('_', $fName)))
+ : '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;