Created
April 17, 2012 19:29
Revisions
-
PhazeonPhoenix created this gist
Apr 17, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php namespace Acme\DemoBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Validator\Constraints as Assert; class DemoType extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { $builder->add('name'); $builder->add('email', 'email', array('label' => 'Your Email')); } public function getName() { return 'demo'; } public function getDefaultOptions(array $options) { $collectionConstraint = new Assert/Collection(array( 'name' => new Assert/MinLength(5), 'email' => new Assert/Email(array('message' => 'Invalid email address')), )); return array('validation_constraint' => $collectionConstraint); } }