Created
June 20, 2013 18:38
-
-
Save TomHAnderson/5825379 to your computer and use it in GitHub Desktop.
Form submission without relations set in exchangeArray
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
$builder = new AnnotationBuilder(); | |
$form = $builder->createForm($test); | |
... | |
$form->get('testResult')->setValueOptions( | |
$this->doctrineSelectOptions( | |
'DbLoadCd\Entity\TestResult', | |
[], | |
['name' => 'ASC'], | |
['Application\Service\Security', 'view'] | |
) | |
); | |
if ($this->getRequest()->isPost()) { | |
$form->setData($this->getRequest()->getPost()->toArray()); | |
$form->setUseInputFilterDefaults(false); | |
$form->setInputFilter($test->getInputFilter()); | |
if ($form->isValid()) { | |
$test->setProject($project); | |
$test->setOwner($em->getRepository('AppleConnect\Entity\User')->find($form->getData()['owner'])); | |
$test->setOperator($em->getRepository('AppleConnect\Entity\User')->find($form->getData()['operator'])); | |
$test->setTestType($em->getRepository('DbLoadCd\Entity\TestType')->find($form->getData()['testType'])); | |
$test->setTestStatus($em->getRepository('DbLoadCd\Entity\TestStatus')->find($form->getData()['testStatus'])); | |
$test->setTestResult($em->getRepository('DbLoadCd\Entity\TestResult')->find($form->getData()['testResult'])); | |
$test->exchangeArray($form->getData()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment