Created
March 5, 2013 00:05
-
-
Save marijn/5086824 to your computer and use it in GitHub Desktop.
Symfony2 array based forms are not taking constraints into account...
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 characters
<?php | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\Validator\Constraints\Length; | |
final class SomeController extends Controller | |
{ | |
/** | |
* @return \Symfony\Component\Form\Form | |
*/ | |
private function getSomeArrayBasedForm() | |
{ | |
return $this->createFormBuilder() | |
->add('capacity', 'integer', array('constraints' => new Length(array('max' => 2500)))) | |
->getForm(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you find any solution to this?