@@ -35,12 +35,12 @@ public function setConfiguration(array $configuration)
3535 $ this ->configuration = $ configuration ;
3636 }
3737
38-
3938 /**
4039 * This method genetates a form based on the configuration file.
4140 * @param string $name The name of the Form
4241 * @param array $data
4342 * @param array $options
43+ *
4444 * @return \Symfony\Component\Form\Form
4545 * @throws InexistentFormException
4646 */
@@ -50,7 +50,7 @@ public function createForm($name, $data = [], $options = [])
5050 throw new InexistentFormException ();
5151 }
5252
53- $ formBuilder = $ this ->formFactory ->createBuilder ( 'form ' , $ data , $ options );
53+ $ formBuilder = $ this ->formFactory ->createNamedBuilder ( $ name , 'form ' , $ data , $ options );
5454
5555
5656 foreach ($ this ->configuration [$ name ] as $ name => $ fieldConfiguration ) {
@@ -60,10 +60,10 @@ public function createForm($name, $data = [], $options = [])
6060
6161 $ fieldOptions = isset ($ fieldConfiguration ['options ' ]) ? $ fieldConfiguration ['options ' ] : [];
6262
63- if (isset ($ fieldConfiguration ['validators ' ])) {
63+ if (isset ($ fieldConfiguration ['validation ' ])) {
6464 $ constraints = [];
6565
66- foreach ($ fieldConfiguration ['validators ' ] as $ validatorName => $ options ) {
66+ foreach ($ fieldConfiguration ['validation ' ] as $ validatorName => $ options ) {
6767 $ constraints [] = new $ validatorName ($ options );
6868 }
6969
@@ -72,7 +72,6 @@ public function createForm($name, $data = [], $options = [])
7272
7373 $ field = $ formBuilder ->create ($ name , $ fieldConfiguration ['type ' ], $ fieldOptions );
7474
75-
7675 if (isset ($ fieldConfiguration ['transformer ' ])) {
7776 $ transformerConfiguration = $ fieldConfiguration ['transformer ' ];
7877 $ transformer = new $ transformerConfiguration ['class ' ]();
@@ -91,7 +90,7 @@ public function createForm($name, $data = [], $options = [])
9190
9291 return $ formBuilder ->getForm ();
9392 }
94-
93+
9594 /**
9695 * @return string
9796 * @throws InexistentFormException
0 commit comments