/**
  * @param string             $type
  * @param string             $context
  * @param ComponentInterface $subject
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function getBaseQueryBuilder($type, $context, ComponentInterface $subject)
 {
     if (!$subject->getId()) {
         throw new \InvalidArgumentException('Component must provide an id.');
     }
     return $this->objectManager->getRepository($this->timelineClass)->createQueryBuilder('Timeline')->field('type')->equals($type)->field('context')->equals($context)->field('subject.id')->equals($subject->getId());
 }
 /**
  * @param ComponentInterface $component component
  * @param string             $type      type
  *
  * @return QueryBuilder
  */
 public function getQueryBuilderForComponent(ComponentInterface $component, $type = null)
 {
     $qb = $this->getQueryBuilderForAction();
     if (null === $type) {
         $qb->innerJoin('a.actionComponents', 'ac2', Expr\Join::WITH, '(ac2.action = a AND ac2.component = :component)');
     } else {
         $qb->innerJoin('a.actionComponents', 'ac2', Expr\Join::WITH, '(ac2.action = a AND ac2.component = :component and ac2.type = :type)')->setParameter('type', $type);
     }
     return $qb->leftJoin('a.actionComponents', 'ac')->setParameter('component', $component->getId());
 }
 protected function getQueryBuilderForSubject(ComponentInterface $subject)
 {
     return $this->objectManager->getRepository($this->actionClass)->createQueryBuilder('a')->field('subject.id')->equals($subject->getId());
 }
 /**
  * @param string             $type
  * @param string             $context
  * @param ComponentInterface $subject
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function getBaseQueryBuilder($type, $context, ComponentInterface $subject)
 {
     if (!$subject->getId()) {
         throw new \InvalidArgumentException('Component must provide an id.');
     }
     return $this->objectManager->getRepository($this->timelineClass)->createQueryBuilder('t')->where('t.type = :type')->andWhere('t.context = :context')->andWhere('t.subject = :subject')->setParameter('type', $type)->setParameter('context', $context)->setParameter('subject', $subject->getId());
 }