3
我正在使用Symfony 1.4並且有使用多個表單驗證程序的問題。Symfony多個帖子驗證程序
對於部分表格,我需要確保電子郵件地址是有效且唯一的。 這裏是我想要使用此代碼:
$this->validatorSchema['email_address'] = new sfValidatorAnd(
array(
new sfValidatorEmail(),
new sfValidatorPropelUnique(array('model' => 'Users', 'column' => 'email_address')
),
));
據我所知,這應該工作。但是,當我發佈表單時,出現以下錯誤消息
您必須將數組參數傳遞給clean()方法(此驗證程序只能用作後驗證程序)。
任何想法或建議嗎?
感謝與mergePostValidator的提示。我對symfony比較陌生,所以有些術語對我來說就像科學疾病名稱一樣。我會注意到在你提供的示例代碼中,調用$ this-> validatorSchema-> mergePostValidator(..)爲我創建了一個未知的方法錯誤,解決方案最終只是$ this-> mergePostValidator(..) – Eric 2012-03-04 05:23:23
我可以確認mergePostvalidator應該在表單instace本身而不是驗證器模式上調用。 – luxerama 2012-08-23 10:51:58
@luxerama:已更正。 – prodigitalson 2012-08-23 12:45:14