| @@ 119-134 (lines=16) @@ | ||
| 116 | * |
|
| 117 | * @Method("DELETE") |
|
| 118 | */ |
|
| 119 | public function deleteAction(Request $request, Currency $currency) |
|
| 120 | { |
|
| 121 | $this->hasPermission(Permissions::CURRENCIES_MANAGE); |
|
| 122 | $translator = $this->get('translator'); |
|
| 123 | if ($this->findByCode($currency)) { |
|
| 124 | $em = $this->get('em'); |
|
| 125 | $em->remove($currency); |
|
| 126 | $em->flush(); |
|
| 127 | ||
| 128 | $this->get('session')->getFlashBag()->add('success', $translator->trans('paywall.success.removed')); |
|
| 129 | } else { |
|
| 130 | $this->get('session')->getFlashBag()->add('error', $translator->trans('paywall.success.notexists')); |
|
| 131 | } |
|
| 132 | ||
| 133 | return $this->redirect($this->generateUrl('paywall_plugin_currency_index')); |
|
| 134 | } |
|
| 135 | ||
| 136 | private function findByCode(CurrencyInterface $currency) |
|
| 137 | { |
|
| @@ 75-90 (lines=16) @@ | ||
| 72 | * |
|
| 73 | * @Method("DELETE") |
|
| 74 | */ |
|
| 75 | public function deleteAction(Request $request, Discount $discount) |
|
| 76 | { |
|
| 77 | $this->hasPermission(Permissions::DISCOUNTS_MANAGE); |
|
| 78 | $translator = $this->get('translator'); |
|
| 79 | if ($this->exists($discount)) { |
|
| 80 | $em = $this->get('em'); |
|
| 81 | $em->remove($discount); |
|
| 82 | $em->flush(); |
|
| 83 | ||
| 84 | $this->get('session')->getFlashBag()->add('success', $translator->trans('paywall.success.removed')); |
|
| 85 | } else { |
|
| 86 | $this->get('session')->getFlashBag()->add('error', $translator->trans('paywall.success.notexists')); |
|
| 87 | } |
|
| 88 | ||
| 89 | return $this->redirect($this->generateUrl('newscoop_paywall_discount_index')); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @Route("/admin/paywall_plugin/discounts/edit/{id}", options={"expose"=true}, name="paywall_plugin_discount_edit") |
|
| @@ 77-92 (lines=16) @@ | ||
| 74 | * |
|
| 75 | * @Method("DELETE") |
|
| 76 | */ |
|
| 77 | public function deleteAction(Request $request, Order $order) |
|
| 78 | { |
|
| 79 | $this->hasPermission(Permissions::ORDERS_MANAGE); |
|
| 80 | $translator = $this->get('translator'); |
|
| 81 | if ($this->exists($order)) { |
|
| 82 | $em = $this->get('em'); |
|
| 83 | $em->remove($order); |
|
| 84 | $em->flush(); |
|
| 85 | ||
| 86 | $this->get('session')->getFlashBag()->add('success', $translator->trans('paywall.success.removed')); |
|
| 87 | } else { |
|
| 88 | $this->get('session')->getFlashBag()->add('error', $translator->trans('paywall.success.notexists')); |
|
| 89 | } |
|
| 90 | ||
| 91 | return $this->redirect($this->generateUrl('paywall_plugin_userorder_index')); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * @Route("/admin/paywall_plugin/orders/create/", options={"expose"=true}, name="paywall_plugin_userorder_create") |
|