/** * @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 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; }
private function createUserFollow(User $user, User $follower) { $followEntity = new \Civix\CoreBundle\Entity\UserFollow(); $followEntity->setStatus(\Civix\CoreBundle\Entity\UserFollow::STATUS_PENDING)->setDateCreate(new \DateTime())->setFollower($follower)->setUser($user); return $followEntity; }
public function getFollower() { $this->__load(); return parent::getFollower(); }