/**
  * Constructor.
  *
  * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
  * @param \FOS\CommentBundle\Sorting\SortingFactory                   $factory
  * @param \Doctrine\ODM\MongoDB\DocumentManager                       $dm
  * @param string                                                      $class
  */
 public function __construct(EventDispatcherInterface $dispatcher, SortingFactory $factory, DocumentManager $dm, $class)
 {
     parent::__construct($dispatcher, $factory);
     $this->dm = $dm;
     $this->repository = $dm->getRepository($class);
     $metadata = $dm->getClassMetadata($class);
     $this->class = $metadata->name;
 }
 /**
  * Returns Thread average note
  *
  * @param Thread $thread
  *
  * @return float
  */
 public function findAverageNote(Thread $thread)
 {
     return $this->commentManager->findAverageNote($thread);
 }