-
-
Save cordoval/899933 to your computer and use it in GitHub Desktop.
This file contains 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
in my controller: | |
-------------------- | |
$form = SalesForm::create($this->get('form.context'), 'sale', array('em' => $em)); | |
in my SalesForm: | |
-------------------- | |
class SalesForm extends Form | |
{ | |
protected function configure() | |
{ | |
$this->addRequiredOption('em'); | |
$this->add(new TextField('city', array( | |
'required' => true, | |
'max_length' => 100, | |
))); | |
$this->add(new TextField('sale', array( | |
'required' => true, | |
))); | |
$this->add(new EntityChoiceField('rep_id', array( | |
'em' => 'em' or $em, // either one of them.... | |
'class' => 'Aware\\SalesBundle\\Entity\\Rep', | |
'property' => 'name', | |
'query_builder' => function($repository) { | |
return $repository->createQueryBuilder('rep'); | |
} | |
))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment