All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Co-authored-by: Matthieu <mtholot19@gmail.com> Reviewed-on: #8 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Module\Sites\Infrastructure\Doctrine;
|
|
|
|
use App\Module\Sites\Domain\Entity\Site;
|
|
use App\Module\Sites\Domain\Repository\SiteRepositoryInterface;
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
/**
|
|
* @extends ServiceEntityRepository<Site>
|
|
*/
|
|
class DoctrineSiteRepository extends ServiceEntityRepository implements SiteRepositoryInterface
|
|
{
|
|
public function __construct(ManagerRegistry $registry)
|
|
{
|
|
parent::__construct($registry, Site::class);
|
|
}
|
|
|
|
public function findById(int $id): ?Site
|
|
{
|
|
return $this->find($id);
|
|
}
|
|
|
|
public function findByName(string $name): ?Site
|
|
{
|
|
return $this->findOneBy(['name' => $name]);
|
|
}
|
|
|
|
/**
|
|
* @return list<Site>
|
|
*/
|
|
public function findAllOrderedByName(): array
|
|
{
|
|
/** @var list<Site> $sites */
|
|
return $this->findBy([], ['name' => 'ASC']);
|
|
}
|
|
|
|
public function save(Site $site): void
|
|
{
|
|
$this->getEntityManager()->persist($site);
|
|
$this->getEntityManager()->flush();
|
|
}
|
|
|
|
public function remove(Site $site): void
|
|
{
|
|
$this->getEntityManager()->remove($site);
|
|
$this->getEntityManager()->flush();
|
|
}
|
|
}
|