pass validation settings directly to method ?validation? of ValiadionComponent
This commit is contained in:
parent
35c4634fa7
commit
f54b3da372
1 changed files with 11 additions and 9 deletions
|
|
@ -44,13 +44,12 @@
|
||||||
/**
|
/**
|
||||||
* 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,10 +92,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check parameter
|
// Check parameter
|
||||||
$param = $params[$index];
|
if(array_key_exists($index, $this->config))
|
||||||
$check = $this->validate($param, $index);
|
{
|
||||||
if($check !== true) {
|
$param = $params[$index];
|
||||||
$validation[$index] = $check;
|
$check = $this->validate($param, $this->config[$index]);
|
||||||
|
if($check !== true) {
|
||||||
|
$validation[$index] = $check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue