/** * 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 NagiosServiceTemplate $value A NagiosServiceTemplate object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(NagiosServiceTemplate $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 NagiosServiceTemplate object. * * @param NagiosServiceTemplate $v * @return NagiosServiceTemplateInheritance The current object (for fluent API support) * @throws PropelException */ public function setNagiosServiceTemplateRelatedByTargetTemplate(NagiosServiceTemplate $v = null) { if ($v === null) { $this->setTargetTemplate(NULL); } else { $this->setTargetTemplate($v->getId()); } $this->aNagiosServiceTemplateRelatedByTargetTemplate = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the NagiosServiceTemplate object, it will not be re-added. if ($v !== null) { $v->addNagiosServiceTemplateInheritanceRelatedByTargetTemplate($this); } return $this; }
if (isset($_POST['request'])) { if ($_POST['request'] == 'add_service_template') { // Check for pre-existing service template with same name if ($lilac->service_template_exists($_POST['template_name'])) { $error = "A service template with that name already exists!"; } else { // Field Error Checking if ($_POST['template_name'] == '' || $_POST['template_description'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { $template = new NagiosServiceTemplate(); $template->setName($_POST['template_name']); $template->setDescription($_POST['template_description']); $template->save(); header("Location: service_template.php?id=" . $template->getId()); } } } } print_header("Service Template Editor"); print_window_header("Add Service Template", "100%"); ?> <form name="service_template_add_form" method="post" action="add_service_template.php"> <input type="hidden" name="request" value="add_service_template" /> <?php double_pane_form_window_start(); ?> <tr bgcolor="f0f0f0"> <td colspan="2" class="formcell"> <b>Template Name:</b><br />