I can't validate my form in Symfony2 with Assert statement at Entity property.
This my Entity:
use Symfony\Component\Validator\Constraints as Assert;
class AqquiringRequestData
{
/**
* @Assert\IsTrue(message="Необходимо принять условия")
* @Assert\NotNull(message="Необходимо принять условия")
*/
public $checkacc;
This one my form builder:
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('checkacc', 'checkbox', array(
'label' => 'I agree',
'required' => false,
'validation_groups' => array('Default'),
));
}
This one is controller action:
$formData = new AqquiringRequestData();
$flow = $this->get('cib.form.flow.aqquiringreq');
$flow->bind($formData);
$form = $flow->createForm();
if ($flow->isValid($form)) {
...
And when i try to submit form with unchecked checkbox it's successfully submitted. What I'm doing wrong?
Thanks!