|
@@ 37-57 (lines=21) @@
|
| 34 |
|
)); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
public function newAction(Request $request) |
| 38 |
|
{ |
| 39 |
|
$form = $this->createForm(NewType::class, $this->getNewRate()); |
| 40 |
|
|
| 41 |
|
$form->handleRequest($request); |
| 42 |
|
|
| 43 |
|
if ($form->isSubmitted() && $form->isValid()) { |
| 44 |
|
|
| 45 |
|
$this->repository->save(array( |
| 46 |
|
$form->getData() |
| 47 |
|
)); |
| 48 |
|
|
| 49 |
|
$this->get('session')->getFlashBag()->add('success', 'run_open_code.exchange_rate.flash.new.success'); |
| 50 |
|
return $this->redirectToRoute('roc_exchange_rate_list'); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
return $this->render($this->settings['new'], array( |
| 54 |
|
'base_template' => $this->settings['base_template'], |
| 55 |
|
'form' => $form->createView() |
| 56 |
|
)); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function editAction(Request $request) |
| 60 |
|
{ |
|
@@ 59-79 (lines=21) @@
|
| 56 |
|
)); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function editAction(Request $request) |
| 60 |
|
{ |
| 61 |
|
$form = $this->createForm(NewType::class, $this->getRateFromRequest($request)); |
| 62 |
|
|
| 63 |
|
$form->handleRequest($request); |
| 64 |
|
|
| 65 |
|
if ($form->isSubmitted() && $form->isValid()) { |
| 66 |
|
|
| 67 |
|
$this->repository->save(array( |
| 68 |
|
$form->getData() |
| 69 |
|
)); |
| 70 |
|
|
| 71 |
|
$this->get('session')->getFlashBag()->add('success', 'run_open_code.exchange_rate.flash.edit.success'); |
| 72 |
|
return $this->redirectToRoute('roc_exchange_rate_list'); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
return $this->render($this->settings['edit'], array( |
| 76 |
|
'base_template' => $this->settings['base_template'], |
| 77 |
|
'form' => $form->createView() |
| 78 |
|
)); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
protected function getNewRate() |
| 82 |
|
{ |