src/Repository/RescanConfigRepository.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\RescanConfig;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. /**
  7.  * @extends ServiceEntityRepository<RescanConfig>
  8.  *
  9.  * @method RescanConfig|null find($id, $lockMode = null, $lockVersion = null)
  10.  * @method RescanConfig|null findOneBy(array $criteria, array $orderBy = null)
  11.  * @method RescanConfig[]    findAll()
  12.  * @method RescanConfig[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  13.  */
  14. class RescanConfigRepository extends ServiceEntityRepository
  15. {
  16.     /**
  17.      * constructor
  18.      *
  19.      * @param ManagerRegistry $registry
  20.      */
  21.     public function __construct(ManagerRegistry $registry)
  22.     {
  23.         parent::__construct($registryRescanConfig::class);
  24.     }
  25.     /**
  26.      * @param RescanConfig $entity
  27.      * @param bool         $flush
  28.      * @return RescanConfig
  29.      */
  30.     public function add(RescanConfig $entitybool $flush false): RescanConfig
  31.     {
  32.         $this->getEntityManager()->persist($entity);
  33.         if ($flush) {
  34.             $this->getEntityManager()->flush();
  35.         }
  36.         return $entity;
  37.     }
  38.     /**
  39.      * @param RescanConfig $entity
  40.      * @param bool         $flush
  41.      * @return void
  42.      */
  43.     public function remove(RescanConfig $entitybool $flush false): void
  44.     {
  45.         $this->getEntityManager()->remove($entity);
  46.         if ($flush) {
  47.             $this->getEntityManager()->flush();
  48.         }
  49.     }
  50. }