@@ 573-586 (lines=14) @@ | ||
570 | * |
|
571 | * @return JsonResponse |
|
572 | */ |
|
573 | public function deleteEntriesAction(Entry $entry) |
|
574 | { |
|
575 | $this->validateAuthentication(); |
|
576 | $this->validateUserAccess($entry->getUser()->getId()); |
|
577 | ||
578 | $em = $this->getDoctrine()->getManager(); |
|
579 | $em->remove($entry); |
|
580 | $em->flush(); |
|
581 | ||
582 | // entry deleted, dispatch event about it! |
|
583 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); |
|
584 | ||
585 | return $this->sendResponse($entry); |
|
586 | } |
|
587 | ||
588 | /** |
|
589 | * Retrieve all tags for an entry. |
|
@@ 650-661 (lines=12) @@ | ||
647 | * |
|
648 | * @return JsonResponse |
|
649 | */ |
|
650 | public function deleteEntriesTagsAction(Entry $entry, Tag $tag) |
|
651 | { |
|
652 | $this->validateAuthentication(); |
|
653 | $this->validateUserAccess($entry->getUser()->getId()); |
|
654 | ||
655 | $entry->removeTag($tag); |
|
656 | $em = $this->getDoctrine()->getManager(); |
|
657 | $em->persist($entry); |
|
658 | $em->flush(); |
|
659 | ||
660 | return $this->sendResponse($entry); |
|
661 | } |
|
662 | ||
663 | /** |
|
664 | * Handles an entries list delete tags from them. |