/**
  * Handles expired registrations. If the $delete parameter is set, then
  * registrations are deleted, else just hidden
  *
  * @param bool $delete Delete
  *
  * @return void
  */
 public function handleExpiredRegistrations($delete = FALSE)
 {
     $registrations = $this->registrationRepository->findExpiredRegistrations(new \DateTime());
     if ($registrations->count() > 0) {
         foreach ($registrations as $registration) {
             /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration */
             if ($delete) {
                 $this->registrationRepository->remove($registration);
             } else {
                 $registration->setHidden(TRUE);
                 $this->registrationRepository->update($registration);
             }
         }
     }
 }
 /**
  * @dataProvider findExpiredRegistrationsDataProvider
  * @test
  */
 public function findExpiredRegistrations($dateNow, $expected)
 {
     $registrations = $this->registrationRepository->findExpiredRegistrations($dateNow);
     $this->assertEquals($expected, $registrations->count());
 }