コード例 #1
0
 public function onBeforeHostDelete(ModelEvent $event)
 {
     /* @var $host Host */
     $host = $event->getModel();
     /* @var $serviceRepository ServiceRepository */
     $serviceRepository = $this->get('devture_nagios.service.repository');
     foreach ($serviceRepository->findByHost($host) as $service) {
         $serviceRepository->delete($service);
     }
 }
コード例 #2
0
 public function onBeforeTimePeriodDelete(ModelEvent $event)
 {
     /* @var $timePeriod TimePeriod */
     $timePeriod = $event->getModel();
     /* @var $contactRepository ContactRepository */
     $contactRepository = $this->get('devture_nagios.contact.repository');
     foreach ($contactRepository->findByTimePeriod($timePeriod) as $contact) {
         $contactRepository->delete($contact);
     }
 }
コード例 #3
0
 public function onBeforeContactDelete(ModelEvent $event)
 {
     /* @var $contact Contact */
     $contact = $event->getModel();
     /* @var $serviceRepository ServiceRepository */
     $serviceRepository = $this->get('devture_nagios.service.repository');
     /* @var $service Service */
     foreach ($serviceRepository->findByContact($contact) as $service) {
         $service->removeContact($contact);
         $serviceRepository->update($service);
     }
 }
コード例 #4
0
 public function onBeforeCommandDelete(ModelEvent $event)
 {
     /* @var $command Command */
     $command = $event->getModel();
     $commandType = $command->getType();
     if ($commandType === Command::TYPE_SERVICE_CHECK) {
         /* @var $serviceRepository ServiceRepository */
         $serviceRepository = $this->get('devture_nagios.service.repository');
         foreach ($serviceRepository->findByCommand($command) as $service) {
             $serviceRepository->delete($service);
         }
     } else {
         if ($commandType === Command::TYPE_SERVICE_NOTIFICATION) {
             /* @var $contactRepository ContactRepository */
             $contactRepository = $this->get('devture_nagios.contact.repository');
             foreach ($contactRepository->findByCommand($command) as $contact) {
                 $contactRepository->delete($contact);
             }
         }
     }
 }