<?php

declare(strict_types=1);

namespace App\Repository;

use App\Entity\ZimbraConfiguration;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

class ZimbraConfigurationRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, ZimbraConfiguration::class);
    }

    public function findSingleton(): ?ZimbraConfiguration
    {
        return $this->createQueryBuilder('z')
            ->setMaxResults(1)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
}
