| Conditions | 3 |
| Paths | 2 |
| Total Lines | 39 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.3332 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function __invoke(Request $request) |
||
| 42 | 1 | { |
|
| 43 | // The Admin with auto injected in the KernelSubscriber |
||
| 44 | 1 | $this |
|
| 45 | ->admin |
||
| 46 | ->handleRequest($request) |
||
| 47 | ; |
||
| 48 | $entity = $this |
||
| 49 | ->admin |
||
| 50 | ->create() |
||
| 51 | ; |
||
| 52 | 1 | ||
| 53 | 1 | // Create the associated form type |
|
| 54 | $formType = $this |
||
| 55 | ->configuration |
||
| 56 | ->getParameter('form') |
||
| 57 | ; |
||
| 58 | $formOptions = $this |
||
| 59 | ->configuration |
||
| 60 | ->getParameter('form_options') |
||
| 61 | ; |
||
| 62 | $form = $this |
||
| 63 | ->formFactory |
||
| 64 | ->create($formType, $entity, $formOptions) |
||
| 65 | ; |
||
| 66 | $form->handleRequest($request); |
||
| 67 | |||
| 68 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 69 | $this |
||
| 70 | ->admin |
||
| 71 | ->save() |
||
| 72 | ; |
||
| 73 | } |
||
| 74 | |||
| 75 | return $this |
||
| 76 | ->responder |
||
| 77 | ->respond($this->configuration, $this->admin, $form, $request->request->get('submit')) |
||
| 78 | ; |
||
| 79 | } |
||
| 80 | } |
||
| 81 |