mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 19:42:41 +00:00
Implementing IteratorAggregate for CakeValidationSet
This commit is contained in:
parent
6f16a66b83
commit
989a8b8398
2 changed files with 41 additions and 2 deletions
|
@ -27,7 +27,7 @@ App::uses('CakeRule', 'Model/Validator');
|
|||
* @package Cake.Model.Validator
|
||||
* @link http://book.cakephp.org/2.0/en/data-validation.html
|
||||
*/
|
||||
class CakeValidationSet implements ArrayAccess {
|
||||
class CakeValidationSet implements ArrayAccess, IteratorAggregate {
|
||||
|
||||
/**
|
||||
* Holds the ValidationRule objects
|
||||
|
@ -284,4 +284,13 @@ class CakeValidationSet implements ArrayAccess {
|
|||
unset($this->_rules[$index]);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns an iterator for each of the rules to be applied
|
||||
*
|
||||
* @return ArrayIterator
|
||||
**/
|
||||
public function getIterator() {
|
||||
return new ArrayIterator($this->_rules);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue