summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-08 18:03:35 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-08 18:03:35 +0100
commita89c1dabd11e8628106b1629f76ec9fc65c20085 (patch)
treee5c79cc8170a4e050e22d16f82fab6e657915805
parent7c60b12da3260cb3046f3f500431a1b7a5fb766d (diff)
Method chaining support for FV set_data(), reset_validation()
-rw-r--r--system/libraries/Form_validation.php7
-rw-r--r--user_guide_src/source/libraries/form_validation.rst6
2 files changed, 9 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 58485916c..7c441409f 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -252,7 +252,7 @@ class CI_Form_validation {
* each array due to the limitations of CI's singleton
*
* @param array $data
- * @return void
+ * @return CI_Form_validation
*/
public function set_data(array $data)
{
@@ -260,6 +260,8 @@ class CI_Form_validation {
{
$this->validation_data = $data;
}
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -1536,7 +1538,7 @@ class CI_Form_validation {
* Prevents subsequent validation routines from being affected by the
* results of any previous validation routine due to the CI singleton.
*
- * @return void
+ * @return CI_Form_validation
*/
public function reset_validation()
{
@@ -1545,6 +1547,7 @@ class CI_Form_validation {
$this->_error_array = array();
$this->_error_messages = array();
$this->error_string = '';
+ return $this;
}
}
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index ae66cefb3..988d6fa25 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -1001,14 +1001,16 @@ Class Reference
.. method:: set_data($data)
:param array $data: Array of data validate
- :rtype: void
+ :returns: CI_Form_validation instance (method chaining)
+ :rtype: CI_Form_validation
Permits you to set an array for validation, instead of using the default
``$_POST`` array.
.. method:: reset_validation()
- :rtype: void
+ :returns: CI_Form_validation instance (method chaining)
+ :rtype: CI_Form_validation
Permits you to reset the validation when you validate more than one array.
This method should be called before validating each new array.