aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/ConfigController.php
diff options
context:
space:
mode:
authorKévin Gomez <contact@kevingomez.fr>2015-10-25 10:45:15 +0100
committerKévin Gomez <contact@kevingomez.fr>2015-11-11 16:27:19 +0100
commit52e423f30761561fa2ad82c708d9fa9186562b1f (patch)
tree35bb85478b635f4e0c185f6567d9be94a60da082 /src/Wallabag/CoreBundle/Controller/ConfigController.php
parent625acf335298186b4ff983f9321900d1238e854b (diff)
downloadwallabag-52e423f30761561fa2ad82c708d9fa9186562b1f.tar.gz
wallabag-52e423f30761561fa2ad82c708d9fa9186562b1f.tar.zst
wallabag-52e423f30761561fa2ad82c708d9fa9186562b1f.zip
Provide a way to delete tagging rules
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/ConfigController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 24b86344..de1536c9 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -189,6 +189,33 @@ class ConfigController extends Controller
189 } 189 }
190 190
191 /** 191 /**
192 * Deletes a tagging rule and redirect to the config homepage.
193 *
194 * @param TaggingRule $rule
195 *
196 * @Route("/tagging-rule/delete/{id}", requirements={"id" = "\d+"}, name="delete_tagging_rule")
197 *
198 * @return \Symfony\Component\HttpFoundation\RedirectResponse
199 */
200 public function deleteTaggingRule(TaggingRule $rule)
201 {
202 if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) {
203 throw $this->createAccessDeniedException('You can not access this tagging ryle.');
204 }
205
206 $em = $this->getDoctrine()->getManager();
207 $em->remove($rule);
208 $em->flush();
209
210 $this->get('session')->getFlashBag()->add(
211 'notice',
212 'Tagging rule deleted'
213 );
214
215 return $this->redirect($this->generateUrl('config'));
216 }
217
218 /**
192 * Retrieve config for the current user. 219 * Retrieve config for the current user.
193 * If no config were found, create a new one. 220 * If no config were found, create a new one.
194 * 221 *