protected function setUp() { \Bh\Lib\Mapper::getEntityManager()->clear(); $this->getConnection(); $this->setForeignKeyChecks(false); parent::setUp(); $this->setForeignKeyChecks(true); }
protected function getAttributesLengths($attribute, $start, $end) { $qb = Mapper::getEntityManager()->createQueryBuilder(); $qb->select('a.name')->addSelect('SUM(r.length) AS length')->from('Bh\\Entity\\Record', 'r')->leftJoin("r.{$attribute}", 'a')->where('r.user = :user')->where('a.user = :user')->setParameter('user', $this->getCurrentUser())->andWhere('r.deleted = false')->andWhere('a.deleted = false')->groupBy('a.id')->orderBy('length', 'DESC'); $this->qbDateClause($qb, $start, $end); return $qb->getQuery()->getArrayResult(); }