| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 5 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | public function showAccountAction(Request $request) |
||
| 24 | { |
||
| 25 | $user = $this->getUser(); |
||
| 26 | $em = $this->getDoctrine()->getManager(); |
||
| 27 | $modules = $em->getRepository('AppBundle:Module') |
||
| 28 | ->getFreeModulesForUser($user); |
||
| 29 | |||
| 30 | if ($request->getMethod() == 'POST') { |
||
| 31 | $choice = $request->get('choice_module'); |
||
| 32 | $user->setChosenModule($choice); |
||
| 33 | $em->flush(); |
||
| 34 | |||
| 35 | return $this->redirectToRoute('account'); |
||
| 36 | } |
||
| 37 | |||
| 38 | return [ |
||
| 39 | 'modules' => $modules, |
||
| 40 | 'user'=>$user |
||
| 41 | |||
| 42 | ]; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |