Beispiel #1
0
 public function load(ObjectManager $manager)
 {
     $incident_closing_types = array(array('name' => "Open"), array('name' => "Closed"), array('name' => "Closed by inactivity"), array('name' => "Stand by"), array('name' => "Removed"), array('name' => "Unresolved"));
     foreach ($incident_closing_types as $incident_closing_type) {
         $newIncidentType = new IncidentState();
         $newIncidentType->setName($incident_closing_type['name']);
         $manager->persist($newIncidentType);
         $this->addReference('IncidentStates-' . $incident_closing_type['name'], $newIncidentType);
     }
     $manager->flush();
 }
Beispiel #2
0
 /**
  * Set state
  *
  * @param \CertUnlp\NgenBundle\Entity\IncidentState $state
  * @return Incident
  */
 public function setState(\CertUnlp\NgenBundle\Entity\IncidentState $state = null)
 {
     if (!in_array($state->getSlug(), ['open', 'stand_by'])) {
         $this->close();
     } else {
         $this->open();
     }
     $this->state = $state;
     return $this;
 }