* * @method |null find($id, $lockMode = null, $lockVersion = null) * @method |null findOneBy(array $criteria, array $orderBy = null) * @method [] findAll() * @method [] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, ::class); } public function add( $entity, bool $flush = false): void { $this->getEntityManager()->persist($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function remove( $entity, bool $flush = false): void { $this->getEntityManager()->remove($entity); if ($flush) { $this->getEntityManager()->flush(); } } }