Development

/branches/1.3/lib/validator/sfValidatorSchemaForEach.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/validator/sfValidatorSchemaForEach.class.php

Revision 9048, 1.3 kB (checked in by FabianLange, 7 years ago)

1.1: fixed @param phpdoc to fit specs in validator (refs #2991)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfValidatorSchemaForEach wraps a validator multiple times in a single validator.
13  *
14  * @package    symfony
15  * @subpackage validator
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfValidatorSchemaForEach extends sfValidatorSchema
20 {
21   /**
22    * Constructor.
23    *
24    * @param sfValidatorBase $validator  Initial validator
25    * @param integer         $count      The number of times to replicate the validator
26    * @param array           $options    An array of options
27    * @param array           $messages   An array of error messages
28    *
29    * @see sfValidatorBase
30    */
31   public function __construct(sfValidatorBase $validator, $count, $options = array(), $messages = array())
32   {
33     $fields = array();
34     for ($i = 0; $i < $count; $i++)
35     {
36       $fields[$i] = clone $validator;
37     }
38
39     parent::__construct($fields, $options, $messages);
40   }
41
42   /**
43    * @see sfValidatorBase
44    */
45   public function asString($indent = 0)
46   {
47     throw new Exception('Unable to convert a sfValidatorSchemaForEach to string.');
48   }
49 }
50
Note: See TracBrowser for help on using the browser.