これはRTMの質問に違いないと確信していますが、間違った場所を見ているに違いありません。symfony 1.4 では、ポストバリデータコールバックをかなり多く使用しました。たとえば、開始日と終了日が正しい順序になっていることを確認します。Silex でアプリを開発していますが、同様の機能をバリデータとして追加する方法がわかりません。これは私が(基本的に)取り組んでいるものです:
$app['form.example'] = function ($app) {
$constraints = new Assert\Collection(array(
'date1' => new Assert\Date(),
'date2' => new Assert\Date(),
));
$builder = $app['form.factory']->createNamedBuilder('form', 'example', array(), array('validation_constraint' => $constraints));
return $builder
->add('date1', 'date')
->add('date2', 'date')
->getForm();
};
次のように、「プロセスフォーム」部分に独自の検証テストを配置できますが、私にif ($form->isValid() && --my datetest--)
は適切ではありません。
何か助けはありますか?ありがとう!