/**
  * 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      NagiosService $value A NagiosService object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(NagiosService $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
 /**
  * Declares an association between this object and a NagiosService object.
  *
  * @param      NagiosService $v
  * @return     NagiosServiceTemplateInheritance The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setNagiosService(NagiosService $v = null)
 {
     if ($v === null) {
         $this->setSourceService(NULL);
     } else {
         $this->setSourceService($v->getId());
     }
     $this->aNagiosService = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the NagiosService object, it will not be re-added.
     if ($v !== null) {
         $v->addNagiosServiceTemplateInheritance($this);
     }
     return $this;
 }
Exemple #3
0
                    // Host logic
                    $c = new Criteria();
                    $c->add(NagiosServicePeer::DESCRIPTION, $_POST['service_description']);
                    $c->add(NagiosServicePeer::HOSTGROUP, $hostgroup->getId());
                    $c->setIgnoreCase(true);
                    $service = NagiosServicePeer::doSelectOne($c);
                    if ($service) {
                        $error = "A service with that description already exists for that hostgroup.";
                    } else {
                        // Let's add.
                        $service = new NagiosService();
                        $service->setDescription($_POST['service_description']);
                        $service->setDisplayName($_POST['display_name']);
                        $service->setHostgroup($hostgroup->getId());
                        $service->save();
                        header("Location: service.php?id=" . $service->getId());
                        die;
                    }
                }
            }
        }
    }
}
print_header("Service Editor");
// Get list of service templates
$lilac->get_service_template_list($tempList);
$template_list[] = array("service_template_id" => '', "template_name" => "None");
foreach ($tempList as $tempTemplate) {
    $template_list[] = array('service_template_id' => $tempTemplate->getId(), 'template_name' => $tempTemplate->getName());
}
print_window_header("Add Service " . $title, "100%");