@@ 102-118 (lines=17) @@ | ||
99 | $form->get('keyword')->addError($error); |
|
100 | } |
|
101 | ||
102 | if ($form->isSubmitted() && $form->isValid()) { |
|
103 | // Create translation |
|
104 | $em->getRepository('KunstmaanTranslatorBundle:Translation')->createTranslations($data); |
|
105 | $em->flush(); |
|
106 | ||
107 | $this->addFlash( |
|
108 | FlashTypes::SUCCESS, |
|
109 | $this->container->get('translator')->trans('settings.translator.succesful_added') |
|
110 | ); |
|
111 | ||
112 | $indexUrl = $configurator->getIndexUrl(); |
|
113 | ||
114 | return new RedirectResponse($this->generateUrl( |
|
115 | $indexUrl['path'], |
|
116 | isset($indexUrl['params']) ? $indexUrl['params'] : [] |
|
117 | )); |
|
118 | } |
|
119 | } |
|
120 | ||
121 | return [ |
|
@@ 172-188 (lines=17) @@ | ||
169 | if ($request->getMethod() === Request::METHOD_POST) { |
|
170 | $form->handleRequest($request); |
|
171 | ||
172 | if ($form->isSubmitted() && $form->isValid()) { |
|
173 | // Update translations |
|
174 | $em->getRepository('KunstmaanTranslatorBundle:Translation')->updateTranslations($translation, $id); |
|
175 | $em->flush(); |
|
176 | ||
177 | $this->addFlash( |
|
178 | FlashTypes::SUCCESS, |
|
179 | $this->container->get('translator')->trans('settings.translator.succesful_edited') |
|
180 | ); |
|
181 | ||
182 | $indexUrl = $configurator->getIndexUrl(); |
|
183 | ||
184 | return new RedirectResponse($this->generateUrl( |
|
185 | $indexUrl['path'], |
|
186 | isset($indexUrl['params']) ? $indexUrl['params'] : [] |
|
187 | )); |
|
188 | } |
|
189 | } |
|
190 | ||
191 | return [ |