$tempHost->setName($_POST['host_manage']['host_name']); $tempHost->setAlias($_POST['host_manage']['alias']); if (isset($_GET['parent_id'])) { // Get the host by that parent_id $host = NagiosHostPeer::retrieveByPk($_GET['parent_id']); if ($host) { // valid host, add parent $tempHost->addParentByName($host->getName()); } } $tempHost->setAddress($_POST['host_manage']['address']); if (isset($_POST['host_manage']['display_name'])) { $tempHost->setDisplayName($_POST['host_manage']['display_name']); } $tempHost->save(); header("Location: hosts.php?id=" . $tempHost->getId()); die; } } } $add_template_list[] = array("host_template_id" => '', "template_name" => "None"); $lilac->get_host_template_list($template_list); if (count($template_list)) { foreach ($template_list as $tempTemplate) { $add_template_list[] = array('host_template_id' => $tempTemplate->getId(), 'template_name' => $tempTemplate->getName()); } } print_header("Add New Host"); $title = "Add A Top-Level Host"; if (isset($_GET['parent_id'])) { $tempHostInfo = NagiosHostPeer::retrieveByPK($_GET['parent_id']);
/** * Declares an association between this object and a NagiosHost object. * * @param NagiosHost $v * @return NagiosEscalation The current object (for fluent API support) * @throws PropelException */ public function setNagiosHost(NagiosHost $v = null) { if ($v === null) { $this->setHost(NULL); } else { $this->setHost($v->getId()); } $this->aNagiosHost = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the NagiosHost object, it will not be re-added. if ($v !== null) { $v->addNagiosEscalation($this); } return $this; }
/** * 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 NagiosHost $value A NagiosHost object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(NagiosHost $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }