namespace Noxlogic\GuestbookBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints;
class CommentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', 'text', array(
'constraints' => new Constraints\NotBlank(),
));
$builder->add('email', 'email');
$builder->add(‘country’, ‘country’);
$builder->add('comment', 'textarea', array(
'constraints' => array(
new Constraints\NotBlank(),
new Constraints\Length(array('min' => 10, 'max' => 50)),
)
));
}
public function getName()
{
return 'comment';
}
}
31