I use symfony validator assert, in my class subscription i have:
/**
* @var string
* @Assert\NotBlank(message="asasass")
* */
private $name;
Forms:
class SubscriptionType extends AbstractType{
public function getName() {
return 'Piotrek_subscription';
}
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('name', 'text', array(
'label' => 'Imię i nazwisko'
))
->add('email', 'text', array(
))
->add('save', 'submit', array(
'label' => 'Zapisz się'
)); }
public function setDefaultOptions(OptionsResolverInterface $resolver) {
$resolver->setDefaults(array(
'data_class' => 'Piotrek\WitajBundle\Entity\Subscription'
));
}
}
And my controler:
$Subscription = new Subscription();
$form = $this->createForm(new SubscriptionType(), $Subscription);
return array(
'form' => $form->createView(),
My form don't read the custom validate in comment. Imposes standard , but also do not know where. When I delete comment the ruler is still the same. So how do you change the text validation?