/**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      NagiosEscalationContact $value A NagiosEscalationContact object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(NagiosEscalationContact $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Exemple #2
0
                $membership->save();
                $success = "New Escalation Contact Group Link added.";
                unset($_POST['escalation_manage']);
            }
        } else {
            if ($_POST['request'] == 'add_contact_command') {
                $c = new Criteria();
                $c->add(NagiosEscalationContactPeer::ESCALATION, $_GET['id']);
                $c->add(NagiosEscalationContactPeer::CONTACT, $_POST['escalation_manage']['contact_add']['contact_id']);
                $membership = NagiosEscalationContactPeer::doSelectOne($c);
                if ($membership) {
                    $error = "That contact already exists in that list!";
                } else {
                    $tempContact = NagiosContactPeer::retrieveByPk($_POST['escalation_manage']['contact_add']['contact_id']);
                    if ($tempContact) {
                        $membership = new NagiosEscalationContact();
                        $membership->setEscalation($_GET['id']);
                        $membership->setNagiosContact($tempContact);
                        $membership->save();
                        $success = "New Escalation Contact Link added.";
                    } else {
                        $error = "That contact is not found.";
                    }
                }
            }
        }
    }
}
if (isset($_GET['id'])) {
    if (!$lilac->get_escalation($_GET['id'], $escalation)) {
        header("Location: welcome.php");
 private function __addContacts($escalation)
 {
     $job = $this->getEngine()->getJob();
     $config = $this->getEngine()->getConfig();
     $segment = $this->getSegment();
     $values = $segment->getValues();
     $fileName = $segment->getFilename();
     // Check if we need to bring in values from a template
     if (isset($values['use'])) {
         // We sure are using a template!
         // Okay, hokey multi-inheritance support for the importer
         $tempValues = $this->getTemplateValues($values['use'][0]['value']);
         // Okay, go through each
         foreach ($tempValues as $key => $val) {
             if (!isset($values[$key])) {
                 $values[$key] = $val;
             }
         }
     }
     if (isset($values['contacts'])) {
         $contactNames = explode(",", $values['contacts'][0]['value']);
         foreach ($contactNames as $contact_name) {
             $contact = NagiosContactPeer::getByName($contact_name);
             if (!$contact) {
                 return false;
             }
             $relationship = new NagiosEscalationContact();
             $relationship->setNagiosContact($contact);
             $relationship->setNagiosEscalation($escalation);
             $relationship->save();
             $contact->clearAllReferences(true);
             $relationship->clearAllReferences(true);
         }
     }
     if (isset($values['contact_groups'])) {
         $contactGroupNames = explode(",", $values['contact_groups'][0]['value']);
         foreach ($contactGroupNames as $contactgroup_name) {
             $contactgroup = NagiosContactGroupPeer::getByName($contactgroup_name);
             if (!$contactgroup) {
                 return false;
             }
             $relationship = new NagiosEscalationContactGroup();
             $relationship->setNagiosContactGroup($contactgroup);
             $relationship->setNagiosEscalation($escalation);
             $relationship->save();
             $contactgroup->clearAllReferences(true);
             $relationship->clearAllReferences(true);
         }
     }
     return true;
 }