public function sendUserFollowRequest(UserFollow $follow)
 {
     $socialActivity = (new SocialActivity(SocialActivity::TYPE_FOLLOW_REQUEST, $follow->getFollower()))->setTarget(['id' => $follow->getId(), 'type' => 'user'])->setRecipient($follow->getUser());
     $this->em->persist($socialActivity);
     $this->em->flush($socialActivity);
     $this->pt->addToQueue('sendInfluencePush', array($follow->getUser()->getId(), $follow->getFollower()->getId()));
     return $socialActivity;
 }
 /**
  * @Route("/{id}")
  * @Method("DELETE")
  */
 public function deleteAction(UserFollow $follow)
 {
     if ($this->getUser() !== $follow->getUser() && $this->getUser() !== $follow->getFollower()) {
         throw new AccessDeniedHttpException();
     }
     $this->getDoctrine()->getManager()->remove($follow);
     $this->getDoctrine()->getManager()->flush($follow);
     return $this->createJSONResponse(null, 204);
 }
 public function handle(UserFollow $follow)
 {
     /* @var $entity UserFollow */
     $entity = $this->findOneBy(['user' => $follow->getUser(), 'follower' => $follow->getFollower()]);
     $entity = $entity ?: $follow;
     $entity->setStatus($follow->getStatus())->setDateCreate(new \DateTime());
     $this->getEntityManager()->persist($entity);
     $this->getEntityManager()->flush($entity);
     return $entity;
 }
 public function getUser()
 {
     $this->__load();
     return parent::getUser();
 }