Skip to content

Instantly share code, notes, and snippets.

@meze
Created December 6, 2012 18:45
Show Gist options
  • Save meze/4226993 to your computer and use it in GitHub Desktop.
Save meze/4226993 to your computer and use it in GitHub Desktop.
<?php
...
$form = $this->createForm(new ContactType, new \test);
$form->bind((array('_token'=>'2f988dd5bee5917e4c7251ccce845885906eeea5',
'amount' => '123')));
var_dump($form->isValid()); // true
return;
<?php
class test {
public $amount;
}
<?php
namespace App\AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class ContactType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('amount', 'choice', array('choices' => array(
'test' =>'test'
)));
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'contact';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment