cvs: pear /DB_DataObject_FormBuilder FormBuilder.php
| From: | Justin Patrin | Date: | Sun, 19 Mar 2006 22:38:23 +0000 |
| Subject: | cvs: pear /DB_DataObject_FormBuilder FormBuilder.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39197@lists.php.net to get a copy of this message | ||
justinpatrin Sun Mar 19 22:38:23 2006 UTC
Modified files:
/pear/DB_DataObject_FormBuilder FormBuilder.php
Log:
BC BREAK! The automatic set* functions are no longer used unless the useAccessors option is set to
true
http://cvs.php.net/viewcvs.cgi/pear/DB_DataObject_FormBuilder/FormBuilder.php?r1=1.221&r2=1.222&diff_format=u
Index: pear/DB_DataObject_FormBuilder/FormBuilder.php
diff -u pear/DB_DataObject_FormBuilder/FormBuilder.php:1.221
pear/DB_DataObject_FormBuilder/FormBuilder.php:1.222
--- pear/DB_DataObject_FormBuilder/FormBuilder.php:1.221 Thu Mar 9 18:09:59 2006
+++ pear/DB_DataObject_FormBuilder/FormBuilder.php Sun Mar 19 22:38:23 2006
@@ -89,7 +89,7 @@
* @author Justin Patrin <papercrane@reversefold.com>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version $Id: FormBuilder.php,v 1.221 2006/03/09 18:09:59 justinpatrin Exp $
+ * @version $Id: FormBuilder.php,v 1.222 2006/03/19 22:38:23 justinpatrin Exp $
* @link http://pear.php.net/package/DB_DataObject_FormBuilder
* @see DB_DataObject, HTML_QuickForm
*/
@@ -850,6 +850,28 @@
var $fieldAttributes = array();
/**
+ * Set to true to use set methods for accessing field values, if they exist.
+ *
+ * If this is set to true and a method exists of the name setFieldName where
+ * FieldName is the name of the field then it will be called to set the value
+ * of the field.
+ *
+ * Note: Do not use a field named From if you use this option. DB_DataObject
+ * has a default method setFrom which will cause problems.
+ *
+ * This option should also turn on using get methods, but it does not currently.
+ *
+ * The following field names will not work with getters due to function collisions
+ * in DB_DataObject:
+ * * Link
+ * * Links
+ * * LinkArray
+ * * DatabaseConnection
+ * * DatabaseResult
+ */
+ var $useAccesors = false;
+
+ /**
* DB_DataObject_FormBuilder::create()
*
* Factory method. As this is meant as an abstract class, it is the only supported
@@ -2628,7 +2650,8 @@
$this->debug('is substituted with "'.print_r($value,
true).'".<br/>');
// See if a setter method exists in the DataObject - if so, use that one
- if (method_exists($this->_do, 'set' . $field)) {
+ if ($this->useAccessors
+ && method_exists($this->_do, 'set' . $field)) {
$this->_do->{'set'.$field}($value);
} else {
// Otherwise, just set the property 'normally'...