1. sfValidatorSchemaForEach.class.php
  2. /** * sfValidatorSchemaForEach wraps a validator multiple times in a single validator. * * @package symfony * @subpackage validator * @author Fabien Potencier * @version SVN: $Id: sfValidatorSchemaForEach.class.php 9048 2008-05-19 09:11:23Z FabianLange $ */
  3. class sfValidatorSchemaForEach extends sfValidatorSchema
  4. {
  5. /**
  6. * Constructor.
  7. *
  8. * @param sfValidatorBase $validator Initial validator
  9. * @param integer $count The number of times to replicate the validator
  10. * @param array $options An array of options
  11. * @param array $messages An array of error messages
  12. *
  13. * @see sfValidatorBase
  14. */
  15. public function __construct(sfValidatorBase $validator, $count, $options = array(), $messages = array())
  16. {
  17. $fields = array();
  18. for ($i = 0; $i < $count; $i++)
  19. {
  20. $fields[$i] = clone $validator;
  21. }
  22. parent::__construct($fields, $options, $messages);
  23. }
  24. /**
  25. * @see sfValidatorBase
  26. */
  27. public function asString($indent = 0)
  28. {
  29. throw new Exception('Unable to convert a sfValidatorSchemaForEach to string.');
  30. }
  31. }

Debug toolbar