pass validation settings directly to method ?validation? of ValiadionComponent

This commit is contained in:
coderkun 2014-04-08 23:47:39 +02:00
commit 723ea4f750

View file

@ -45,12 +45,11 @@
* Validate an user input. * Validate an user input.
* *
* @param mixed $input User input to validate * @param mixed $input User input to validate
* @param string $name Name of the field to validate against * @param array $settings Validation setting
* @return mixed True or the settings the validation fails on * @return mixed True or the settings the validation fails on
*/ */
public function validate($input, $name) public function validate($input, $settings)
{ {
$settings = $this->config[$name];
$validation = array(); $validation = array();
// Min string length // Min string length
@ -93,12 +92,15 @@
} }
// Check parameter // Check parameter
if(array_key_exists($index, $this->config))
{
$param = $params[$index]; $param = $params[$index];
$check = $this->validate($param, $index); $check = $this->validate($param, $this->config[$index]);
if($check !== true) { if($check !== true) {
$validation[$index] = $check; $validation[$index] = $check;
} }
} }
}
// Return true or the failed parameters with failed settings // Return true or the failed parameters with failed settings