ebs/src/Repository/PageRepository.php
2023-12-21 08:49:38 +01:00

33 lines
910 B
PHP

<?php
declare(strict_types=1);
namespace App\Repository;
use App\Entity\Page;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Page>
*
* @method Page|null find($id, $lockMode = null, $lockVersion = null)
* @method Page|null findOneBy(array $criteria, array $orderBy = null)
* @method Page|null findOneBySlug(string $slug)
* @method Page[] findAll()
* @method Page[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
final class PageRepository extends ServiceEntityRepository
{
private const ENTITY_CLASS = Page::class;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, self::ENTITY_CLASS);
}
public function getHome(): ?Page
{
return $this->findOneBy(['home' => true]);
}
}