Example #1
0
 /**
  * @param $user UserInterface
  * @return Author
  */
 private function createAuthor($user)
 {
     $author = new Author();
     $author->setAuthorClass(get_class($user))->setAuthorId($user->getId());
     return $author;
 }
 public function checkExistAuthor(Conversation $conversation, Author $author)
 {
     return $this->createQueryBuilder('r')->select('COUNT(r)')->innerJoin('r.authors', 'authors')->where('authors.id = :author_id')->andWhere('r.id = :id')->setParameter('id', $conversation->getId())->setParameter('author_id', $author->getId())->getQuery()->getSingleScalarResult();
 }