开发者

how compare two validators for one field?

开发者 https://www.devze.com 2023-04-05 19:49 出处:网络
I must use two validator for one fields: $this->setVa开发者_运维问答lidator(\'number\', new sfValidatorDoctrineUnique(

I must use two validator for one fields:

$this->setVa开发者_运维问答lidator('number', new sfValidatorDoctrineUnique(
                    array('model' => 'Data', 'column' => 'number')               )
          );

$this->setValidator('number', new sfValidatorString(array('required' => true)));

now working only secons validators. how can i compare this?


You can use:

$this->validatorSchema['number'] = new sfValidatorAnd(array(
  new sfValidatorDoctrineUnique(array('model' => 'Data', 'column' => 'number'),
  new sfValidatorString(array('required' => true)),
));
0

精彩评论

暂无评论...
验证码 换一张
取 消