1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 21:00:09 -07:00

Add findSubthemes function

This commit is contained in:
David Hübner 2017-04-13 18:59:59 +02:00
parent 5f757f9756
commit 6042c05cb0

View File

@ -2,8 +2,21 @@
namespace AppBundle\Repository\Rebrickable; namespace AppBundle\Repository\Rebrickable;
use AppBundle\Entity\Rebrickable\Theme;
use AppBundle\Repository\BaseRepository; use AppBundle\Repository\BaseRepository;
use Doctrine\ORM\Query\Expr\Join;
class ThemeRepository extends BaseRepository class ThemeRepository extends BaseRepository
{ {
public function findAllSubthemes(Theme $theme) {
$subQueryBuilder = $this->createQueryBuilder('subtheme');
$queryBuilder = $this->createQueryBuilder('subtheme')
->leftJoin(Theme::class,'theme', Join::WITH, 'subtheme.parent = theme.id')
->where('subtheme.parent = :id')
->setParameter('id', $theme->getId());
return $queryBuilder->getQuery()->getResult();
}
} }