/**
  * @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
  *
  * @return AdminInterface
  */
 protected function getAdmin(ComponentInterface $component, ActionInterface $action = null)
 {
     if ($action && ($adminComponent = $action->getComponent('admin_code'))) {
         return $this->pool->getAdminByAdminCode($adminComponent);
     }
     try {
         return $this->pool->getAdminByClass($component->getModel());
     } catch (\RuntimeException $e) {
     }
     return false;
 }
 /**
  * @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 ComponentInterface $subject subject
  *
  * @return string
  */
 protected function getSubjectRedisKey(ComponentInterface $subject)
 {
     return sprintf('%s:%s', $this->prefix, $subject->getHash());
 }
 /**
  * @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());
 }
 /**
  * @param ComponentInterface $component component
  *
  * @return QueryBuilder
  */
 public function addSubject(ComponentInterface $component)
 {
     $this->subjects[$component->getHash()] = $component;
     return $this;
 }
Beispiel #8
0
 /**
  * {@inheritdoc}
  */
 public function getIdent()
 {
     return $this->subject->getHash();
 }