public function import() { $job = $this->getEngine()->getJob(); $config = $this->getEngine()->getConfig(); $command = new NagiosCommand(); $segment = $this->getSegment(); // First check if we have a use $useTemplate = $segment->get("use"); if ($useTemplate) { // Okay, we need to check to see if we have an existing dependency $val = $useTemplate[0]['value']; $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $dependant = NagiosCommandPeer::doSelectOne($c); if ($dependant) { $command->setLine($dependant->getLine()); } $dependant->clearAllReferences(true); } $values = $segment->getValues(); $fileName = $segment->getFilename(); $commandLine = array(); foreach ($values as $key => $entries) { foreach ($entries as $entry) { $value = $entry['value']; $lineNum = $entry['line']; if (key_exists($key, $this->fieldMethods) && $this->fieldMethods[$key] != '') { if ($key == "command_line") { // Combine into our line array $commandLine[] = $value; continue; } // Okay, let's check that the method DOES exist if (!method_exists($command, $this->fieldMethods[$key])) { $job->addError("Method " . $this->fieldMethods[$key] . " does not exist for variable: " . $key . " on line " . $lineNum . " in file " . $fileName); if (!$config->getVar('continue_error')) { return false; } } else { call_user_method($this->fieldMethods[$key], $command, $value); } } } } // re-assemble command $commandLine = implode(',', $commandLine); $command->setLine($commandLine); $command->save(); $command->clearAllReferences(true); $job->addNotice("NagiosCommandImporter finished importing command: " . $command->getName()); return true; }