/**
  * @Route("/l/{id}/votedown.{_format}", name="line_votedown",
  *      requirements={"id": "\d+", "_format": "|json"},
  *      defaults={"_format": "html"},
  *      options={"expose": true}
  * )
  * @Method({"POST"})
  */
 public function voteDownAction(Line $line, Request $request)
 {
     $vote = new Vote();
     $vote->setLine($line)->setIp($request->getClientIp())->setPositive(false);
     $authChecker = $this->get('security.authorization_checker');
     if ($authChecker->isGranted('votedown', $vote) === false) {
         throw new AccessDeniedHttpException('Unable to vote from that IP address again');
     }
     $line->addVote($vote);
     $lineRepo = $this->get('fansubebooks.entity.repository.line_repository');
     $lineRepo->update($line);
     if ($request->getRequestFormat() == 'json') {
         $serializer = $this->get('jms_serializer');
         return new Response($serializer->serialize($vote, 'json'), 200, ['Content-Type' => 'application/json']);
     }
     // todo redirect to referrer
     return $this->redirect($this->generateUrl('line', ['id' => $line->getId(), 'voted_down' => true]));
 }
 /**
  * Add vote
  *
  * @param \ChaosTangent\FansubEbooks\Entity\Vote $vote
  * @return Line
  */
 public function addVote(\ChaosTangent\FansubEbooks\Entity\Vote $vote)
 {
     $vote->setLine($this);
     $this->votes[] = $vote;
     return $this;
 }