Example #1
0
 protected function setUp()
 {
     \Bh\Lib\Mapper::getEntityManager()->clear();
     $this->getConnection();
     $this->setForeignKeyChecks(false);
     parent::setUp();
     $this->setForeignKeyChecks(true);
 }
Example #2
0
 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();
 }