diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 27 |
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 | * |