getEntityManager()->persist($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function remove(Registration $entity, bool $flush = false): void { $this->getEntityManager()->remove($entity); if ($flush) { $this->getEntityManager()->flush(); } } }