/**
  * checks if follower is following the given slug
  * @param LocalAuthor $follower follower to slug
  * @param string      $slug     being followed
  *
  * @return boolean               true if following false otherwise
  */
 public function isFollowing(LocalAuthor $follower, $slug = '')
 {
     $localAuthor = $this->service->getRepository('BugglMainBundle:LocalAuthor')->findOneBy(array('slug' => $slug));
     $follow = $this->service->getRepository('BugglMainBundle:Follower')->findOneBy(array('localAuthor' => $follower));
     if (is_null($follow)) {
         return false;
     }
     $following = json_decode($follow->getFollowing(), true);
     return in_array($localAuthor->getId(), $following);
 }
 /**
  * @param string $string
  *
  * @return self
  */
 public function setRepository($string = '')
 {
     $this->repository = $this->repositoryService->getRepository($string);
     return $this;
 }
 public function __construct(EntityRepositoryService $service)
 {
     $this->service = $service;
     $this->repository = $service->getRepository('BugglMainBundle:LocalAuthorPhoto');
 }