chamilo/chamilo-lms

View on GitHub
src/CoreBundle/Traits/Repository/RepositoryQueryBuilderTrait.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

namespace Chamilo\CoreBundle\Traits\Repository;

/* For licensing terms, see /license.txt */

use Doctrine\ORM\QueryBuilder;

trait RepositoryQueryBuilderTrait
{
    abstract public function createQueryBuilder($alias, $indexBy = null);

    protected function getOrCreateQueryBuilder(QueryBuilder $qb = null, string $alias = 'resource'): QueryBuilder
    {
        return $qb ?: $this->createQueryBuilder($alias);
    }
}