<?php

namespace App\Repository;

use App\Entity\SecteurEquipement;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @extends ServiceEntityRepository<SecteurEquipement>
 *
 * @method SecteurEquipement|null find($id, $lockMode = null, $lockVersion = null)
 * @method SecteurEquipement|null findOneBy(array $criteria, array $orderBy = null)
 * @method SecteurEquipement[]    findAll()
 * @method SecteurEquipement[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class SecteurEquipementRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, SecteurEquipement::class);
    }

    /**
     * @throws ORMException
     * @throws OptimisticLockException
     */
    public function add(SecteurEquipement $entity, bool $flush = true): void
    {
        $this->_em->persist($entity);
        if ($flush) {
            $this->_em->flush();
        }
    }

    /**
     * @throws ORMException
     * @throws OptimisticLockException
     */
    public function remove(SecteurEquipement $entity, bool $flush = true): void
    {
        $this->_em->remove($entity);
        if ($flush) {
            $this->_em->flush();
        }
    }
}
