/** * update. * * @param Service $service * @param Incident $incident * * @return Service */ public function update(Service $service, Incident $incident) { if ($incident->getStatus() != Incident::RESOLVED) { $service->setStatus(Service::OUTAGE); } else { $service->setStatus(Service::OPERATIONNAL); } return $service; }
/** * Get a css class for an event status. * * @param Incident $incident * * @return string */ public function getIncidentStatusCss(Incident $incident) { switch ($incident->getStatus()) { case Incident::RESOLVED: return 'fa-check textgreen'; case Incident::IDENTIFIED: case Incident::MONITORING: return 'fa-bolt textorange'; case Incident::INVESTIGATING: return 'fa-times textred'; default: return ''; } }
/** * {@inheritdoc} */ public function load(ObjectManager $manager) { $dataSets = [['name' => 'Mysql is down', 'status' => 0, 'user' => 'user-admin', 'description' => 'Here you should put some description in order to inform our users.'], ['name' => 'Mysql is in a strange state', 'status' => 1, 'readable_status' => '', 'user' => 'user-admin', 'description' => 'Here you should put some description in order to inform our users.'], ['name' => 'Mysql is ok now', 'status' => 2, 'user' => 'user-admin', 'description' => 'Here you should put some description in order to inform our users.']]; foreach ($dataSets as $data) { $today = Carbon::now(); $incident = new Incident(); $incident->setName($data['name']); $incident->setStatus($data['status']); $incident->setService($this->getReference('service-0')); $incident->setCreatedAt($today); $incident->setDescription($data['description']); $incident->setUser($this->getReference($data['user'])); $manager->persist($incident); } $manager->flush(); }