Files
chill-bundles/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php
2021-08-19 11:15:20 +02:00

63 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Repository;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Doctrine\Persistence\ObjectRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class DocGeneratorTemplateRepository implements ObjectRepository
{
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{
$this->repository = $entityManager->getRepository(DocGeneratorTemplate::class);
}
public function find($id, $lockMode = null, $lockVersion = null): ?DocGeneratorTemplate
{
return $this->repository->find($id, $lockMode, $lockVersion);
}
public function findOneBy(array $criteria, array $orderBy = null): ?DocGeneratorTemplate
{
return $this->repository->findOneBy($criteria, $orderBy);
}
/**
* @return DocGeneratorTemplate[]
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @return DocGeneratorTemplate[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findByEntity($entity) {
$builder = $this->repository->createQueryBuilder('t');
$builder
->where('t.entities LIKE :entity')
->setParameter('entity', '%'.addslashes($entity).'%')
;
return $builder->getQuery()->execute();
}
public function getClassName() {
return DocGeneratorTemplate::class;
}
}