3 namespace Wallabag\FederationBundle\Controller
;
5 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
;
6 use Symfony\Bundle\FrameworkBundle\Controller\Controller
;
7 use Wallabag\CoreBundle\Entity\Entry
;
8 use Wallabag\CoreBundle\Event\Activity\Actions\Federation\RecommendedEntryEvent
;
9 use Wallabag\FederationBundle\Entity\Account
;
11 class RecommandController
extends Controller
14 * @Route("/recommend/{entry}", name="recommend-entry")
18 public function postRecommendAction(Entry
$entry)
20 if ($entry->getUser() !== $this->getUser()) {
21 $this->createAccessDeniedException("You can't recommend entries which are not your own");
23 $em = $this->getDoctrine()->getManager();
25 $entry->setRecommended(true);
30 $this->get('event_dispatcher')->dispatch(RecommendedEntryEvent
::NAME
, new RecommendedEntryEvent($entry));
32 $this->redirectToRoute('view', ['id' => $entry->getId()]);