protected function hasUserVoted($vote) {
        $dql = "SELECT count(v.id) FROM CsnCms\Entity\Vote v LEFT JOIN v.usersVoted u WHERE v.id = ?0 AND u.id =?1";
        $query = $this->entityManager->createQuery($dql);

        $voteId = $vote->getId();

        $user = $this->getView()->identity();
        $hasUserVoted = -1;

        if ($voteId != null && $user != null) {
            $userId = $user->getId();
            $query->setParameter(0, $voteId);
            $query->setParameter(1, $userId);
            $hasUserVoted = $query->getSingleScalarResult();
        }

        return $hasUserVoted;
    }