Skip to content

Instantly share code, notes, and snippets.

@marijn
Created March 5, 2013 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marijn/5086824 to your computer and use it in GitHub Desktop.
Save marijn/5086824 to your computer and use it in GitHub Desktop.
Symfony2 array based forms are not taking constraints into account...
<?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();
}
}
@rodrigolopezguerra
Copy link

Did you find any solution to this?

@marijn
Copy link
Author

marijn commented Nov 25, 2013

Hi @rodrigolopezguerra, I stopped using the form framework 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment