<?php

declare(strict_types=1);

namespace App\Module\Commercial\Infrastructure\Doctrine;

use App\Module\Commercial\Domain\Entity\ClientRib;
use App\Module\Commercial\Domain\Repository\ClientRibRepositoryInterface;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @extends ServiceEntityRepository<ClientRib>
 */
class DoctrineClientRibRepository extends ServiceEntityRepository implements ClientRibRepositoryInterface
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, ClientRib::class);
    }

    public function findById(int $id): ?ClientRib
    {
        return $this->find($id);
    }

    public function save(ClientRib $rib): void
    {
        $this->getEntityManager()->persist($rib);
        $this->getEntityManager()->flush();
    }
}
