mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Api point for docgen templates
This commit is contained in:
@@ -1,21 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Repository;
|
||||
|
||||
use App\Entity\DocGeneratorTemplate;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
* @method DocGeneratorTemplate|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method DocGeneratorTemplate|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method DocGeneratorTemplate[] findAll()
|
||||
* @method DocGeneratorTemplate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class DocGeneratorTemplateRepository extends ServiceEntityRepository
|
||||
final class DocGeneratorTemplateRepository implements ObjectRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
parent::__construct($registry, DocGeneratorTemplate::class);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user