public static function search($query_string, $sf_user, $limit = 12) { $query_string = trim($query_string); if (!is_null($query_string) && !empty($query_string) && '' != $query_string && strlen($query_string) > 3) { $criteria = new Criteria(); $criteria->setIgnoreCase(true); $criteria->setLimit($limit); $criteria->add(SchoolYearStudentPeer::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveCurrent()->getId()); $criteria->addJoin(SchoolYearStudentPeer::STUDENT_ID, self::ID); $criteria->addJoin(self::PERSON_ID, PersonPeer::ID, Criteria::INNER_JOIN); $criteria->addAscendingOrderByColumn(PersonPeer::LASTNAME); if (is_numeric($query_string)) { // Search by identification number $criteria->add(PersonPeer::IDENTIFICATION_NUMBER, $query_string . '%', Criteria::LIKE); } else { // Search by firstname or lastname $criterion = $criteria->getNewCriterion(PersonPeer::FIRSTNAME, $query_string . '%', Criteria::LIKE); $criterion->addOr($criteria->getNewCriterion(PersonPeer::LASTNAME, $query_string . '%', Criteria::LIKE)); $criteria->add($criterion); } if ($sf_user->isPreceptor()) { PersonalPeer::joinWithStudents($criteria, $sf_user->getGuardUser()->getId()); } elseif ($sf_user->isTeacher()) { TeacherPeer::joinWithStudents($criteria, $sf_user->getGuardUser()->getId()); } //FALTA HEAD PRECEPTOR return self::doSelectActive($criteria); } return array(); }
public static function retrieveByUuid($value) { $c = new Criteria(); $c->add(self::UUID, $value); $c->setIgnoreCase(true); return self::doSelectOne($c); }
public function addWordColumnCriteria(Criteria $criteria, $field, $value) { $value = "%{$value}%"; $criteria->setIgnoreCase(true); $criterion = $criteria->getNewCriterion(SubjectPeer::NAME, $value, Criteria::LIKE); $criterion->addOr($criteria->getNewCriterion(SubjectPeer::FANTASY_NAME, $value, Criteria::LIKE)); $criteria->add($criterion); }
public static function getNbFiles($entity, $entity_id) { $c = new Criteria(); $c->add(sfFileGalleryPeer::ENTITY, $entity); $c->add(sfFileGalleryPeer::ENTITY_ID, $entity_id); $c->setIgnoreCase(true); return sfFileGalleryPeer::doCount($c); }
public function getByName($name) { $c = new Criteria(); $c->add(NagiosTimeperiodPeer::NAME, $name); $c->setIgnoreCase(true); $timeperiod = NagiosTimeperiodPeer::doSelectOne($c); if (!$timeperiod) { return false; } return $timeperiod; }
public function getByName($name) { $c = new Criteria(); $c->add(NagiosHostTemplatePeer::NAME, $name); $c->setIgnoreCase(true); $template = NagiosHostTemplatePeer::doSelectOne($c); if (!$template) { return false; } return $template; }
public function getByName($name) { $c = new Criteria(); $c->add(NagiosContactPeer::NAME, $name); $c->setIgnoreCase(true); $contact = NagiosContactPeer::doSelectOne($c); if (!$contact) { return false; } return $contact; }
public function getByName($name) { $c = new Criteria(); $c->add(NagiosHostgroupPeer::NAME, $name); $c->setIgnoreCase(true); $hostgroup = NagiosHostgroupPeer::doSelectOne($c); if (!$hostgroup) { return false; } return $hostgroup; }
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; }
public function addUsernameColumnCriteria(Criteria $criteria, $field, $value) { $value = trim($value); if ($value != '') { $value = "%{$value}%"; $criteria->setIgnoreCase(true); $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID); $criteria->addJoin(PersonPeer::USER_ID, sfGuardUserPeer::ID); $criterion = $criteria->getNewCriterion(sfGuardUserPeer::USERNAME, $value, Criteria::LIKE); $criteria->add($criterion); } }
public static function retrievePager($c = null, $page = 1, $max = 10) { if ($c == null) { $c = new Criteria(); } $c->addDescendingOrderByColumn(self::LAST_NAME); $c->setIgnoreCase(true); $pager = new sfPropelPager('sfGuardUserProfile', $max); $pager->setCriteria($c); $pager->setPeerMethod('doSelectJoinSfGuardUser'); $pager->setPage($page); $pager->init(); return $pager; }
public static function getLightboxArray($entity, $entity_id) { $images = array(); $c = new Criteria(); $c->add(sfPhotoGalleryPeer::ENTITY, $entity); $c->add(sfPhotoGalleryPeer::ENTITY_ID, $entity_id); $c->setIgnoreCase(true); $photos = sfPhotoGalleryPeer::doSelect($c); if (count($photos) > 0) { foreach ($photos as $photo) { $images[] = array('real_name' => $photo->getRealName(), 'options' => array('title' => $photo->getDescription())); } } return $images; }
public static function retrieveByEmail($value) { $data = split('@', $value); $email = $data[1]; $c = new Criteria(); $c->add(self::EMAIL, $email); $c->setIgnoreCase(true); $result = self::doSelectOne($c); if ($result == null) { sfContext::getInstance()->getLogger()->log('no matching email domain for (' . $email . ')'); return false; } sfContext::getInstance()->getLogger()->log('matching email domain found'); return $result; }
public static function getByHostTemplateAndDescription($hostTemplateName, $description) { // First get host template $template = NagiosHostTemplatePeer::getByName($hostTemplateName); if (!$template) { return false; } $c = new Criteria(); $c->add(NagiosServicePeer::HOST_TEMPLATE, $template->getId()); $c->add(NagiosServicePeer::DESCRIPTION, $description); $c->setIgnoreCase(true); $service = NagiosServicePeer::doSelectOne($c); if (!$service) { return false; } return $service; }
public static function retrievePager($c = null, $page = 1, $max = null) { if ($c == null) { $c = new Criteria(); } if ($max == null) { $max = sfConfig::get('app_pager_project_max'); } $c->addDescendingOrderByColumn(ProjectPeer::CREATED_AT); $c->setIgnoreCase(true); $pager = new sfPropelPager('Project', $max); $pager->setCriteria($c); //$pager->setPeerMethod('doSelectJoinSfGuardUserRelatedByOwnerId'); $pager->setPage($page); $pager->init(); return $pager; }
/** * */ public function testBigIntIgnoreCaseOrderBy() { // Some sample data $b = new Bookstore(); $b->setStoreName("SortTest1")->setPopulationServed(2000)->save(); $b = new Bookstore(); $b->setStoreName("SortTest2")->setPopulationServed(201)->save(); $b = new Bookstore(); $b->setStoreName("SortTest3")->setPopulationServed(302)->save(); $b = new Bookstore(); $b->setStoreName("SortTest4")->setPopulationServed(10000000)->save(); $c = new Criteria(); $c->setIgnoreCase(true); $c->add(BookstorePeer::STORE_NAME, 'SortTest%', Criteria::LIKE); $c->addAscendingOrderByColumn(BookstorePeer::POPULATION_SERVED); $rows = BookstorePeer::doSelect($c); $this->assertEquals('SortTest2', $rows[0]->getStoreName()); $this->assertEquals('SortTest3', $rows[1]->getStoreName()); $this->assertEquals('SortTest1', $rows[2]->getStoreName()); $this->assertEquals('SortTest4', $rows[3]->getStoreName()); }
public static function retrieveForSelect($q, $limit, $columnname) { $criteria = new Criteria(); $criteria->add(constant('FiledescPeer::' . strtoupper($columnname)), '%' . $q . '%', Criteria::LIKE); $criteria->setDistinct(true); $criteria->addAscendingOrderByColumn(constant('FiledescPeer::' . strtoupper($columnname))); $criteria->setLimit($limit); $criteria->setIgnoreCase(true); $values = array(); $getFunctionKey = "get{$columnname}"; $getFunctionValue = "get{$columnname}"; $result = FiledescPeer::doSelect($criteria); foreach ($result as $value) { $current_result = array(); $current_result["id"] = (string) $value->{$getFunctionValue}(); $current_result["label"] = (string) $value->{$getFunctionValue}(); $current_result["value"] = (string) $value->{$getFunctionValue}(); $values[] = $current_result; } return $values; }
public function testOrderByIgnoreCase() { $originalDB = Propel::getDB(); Propel::setDB(null, new DBMySQL()); $criteria = new Criteria(); $criteria->setIgnoreCase(true); $criteria->addAscendingOrderByColumn(BookPeer::TITLE); $criteria->addAsColumn(BookPeer::TITLE, 'title'); $params = array(); $sql = BasePeer::createSelectSql($criteria, $params); $expectedSQL = 'SELECT UPPER(book.TITLE) FROM `book` ORDER BY UPPER(book.TITLE) ASC'; $this->assertEquals($expectedSQL, $sql); $criteria = new Criteria(); $criteria->setIgnoreCase(true); $criteria->addAscendingOrderByColumn(BookPeer::TITLE); BookPeer::addSelectColumns($criteria); $params = array(); $sql = BasePeer::createSelectSql($criteria, $params); $expectedSQL = 'SELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID, UPPER(book.TITLE) FROM `book` ORDER BY UPPER(book.TITLE) ASC'; $this->assertEquals($expectedSQL, $sql); Propel::setDB(null, $originalDB); }
public function executeAddPerson() { $this->forward404Unless($this->type = $this->getRequestParameter('type')); $this->forward404Unless($this->etime_id = $this->getRequestParameter('etime_id')); if ($this->getRequest()->getMethod() == sfRequest::POST) { $c = new Criteria(); $c->setIgnoreCase(true); $c->add(PersonTypePeer::NAME, '%' . $this->getRequestParameter('type') . '%', Criteria::LIKE); $person_type = PersonTypePeer::doSelectOne($c); $this->forward404Unless($person_type); $etime_person = new EtimePeople(); $etime_person->setEtimeId($this->getRequestParameter('etime_id')); $etime_person->setName($this->getRequestParameter('etime_person_name_' . $this->type)); $etime_person->setEmail($this->getRequestParameter('etime_email_' . $this->type)); $etime_person->setPhone($this->getRequestParameter('etime_phone_' . $this->type)); $etime_person->setPersonTypeId($person_type->getId()); $etime_person->save(); return $this->redirect($this->getRequestParameter('referer', '@homepage')); } $this->getRequest()->getParameterHolder()->set('referer', $this->getRequest()->getReferer()); return sfView::SUCCESS; }
/** * Adds sort criteria * request object is like this; * * <code> * $request['sort'] = json encoded([{field: 'node_name',direction: 'ASC'},{field: 'name',direction: 'ASC'}]) * or * $request['sort'] = $field_name; // file name to sort * $request['dir'] = $dir; // direction ASC or DESC * </code> * * @param Criteria $criteria * * */ protected function addSortCriteria(Criteria $criteria) { $sort = $this->getRequestParameter('sort'); $sort_array = json_decode($sort, true); if (gettype($sort_array) == 'array') { $sort = $sort_array; } if ($sort == '') { return; } $sort_els = $sort; if (!is_array($sort)) { $sort_els = array(array('field' => $sort, 'direction' => $this->getRequestParameter('dir'))); } foreach ($sort_els as $sort_info) { $field = $sort_info['field']; if (preg_match('/^node_(.*)/', $field, $matches)) { $field = $matches[1]; $column = EtvaNodePeer::translateFieldName(sfInflector::camelize($field), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); } else { $column = EtvaServerPeer::translateFieldName(sfInflector::camelize($field), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME); } if ('asc' == strtolower($sort_info['direction'])) { $criteria->addAscendingOrderByColumn($column); } else { $criteria->addDescendingOrderByColumn($column); } $criteria->setIgnoreCase(true); } }
public function import() { $job = $this->getEngine()->getJob(); $config = $this->getEngine()->getConfig(); $timePeriod = new NagiosTimeperiod(); $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(NagiosTimeperiodPeer::NAME, $val); $c->setIgnoreCase(true); $dependant = NagiosTimeperiodPeer::doSelectOne($c); if ($dependant) { // We need to add all the entries from that time period to ours. $entries = $dependant->getNagiosTimeperiodEntrys(); foreach ($entries as $entry) { $tempEntry = new NagiosTimeperiodEntry(); $tempEntry->setEntry($entry->getEntry()); $tempEntry->setValue($entry->getValue()); $timePeriod->addNagiosTimeperiodEntry($tempEntry); } $exclusions = $dependant->getNagiosTimeperiodExcludesRelatedByTimeperiodId(); foreach ($exclusions as $exclusion) { $tempExclusion = new NagiosTimeperiodExclude(); $tempExclusion->setNagiosTimeperiodRelatedByTimeperiodId($timePeriod); $tempExclusion->setNagiosTimeperiodRelatedByExcludedTimeperiod($exclusion->getNagiosTimeperiodRelatedByExcludedTimePeriod); } $dependent->clearAllReferences(true); } } $values = $segment->getValues(); $fileName = $segment->getFilename(); foreach ($values as $key => $entries) { foreach ($entries as $entry) { if ($key == "exclude") { continue; } $value = $entry['value']; $lineNum = $entry['line']; if ($key == "use") { continue; } if (key_exists($key, $this->fieldMethods) && $this->fieldMethods[$key] != '') { // Okay, let's check that the method DOES exist if (!method_exists($timePeriod, $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], $timePeriod, $value); } } else { // It's an entry. Let's rebuild the string and grab the entry and value // This is pretty hackish $pos = $this->preg_pos("/[0-9]{1,2}:[0-9]{1,2}/", $entry['text']); // Look for the first 00:00 $tempLabel = trim(substr($entry['text'], 0, $pos - 1)); $commentPos = strpos($entry['text'], ";"); if ($commentPos === false) { $commentLength = 0; } else { $commentLength = strlen(substr($entry['text'], $commentPos)); } $valLength = strlen($entry['text']) - ($commentLength + $pos); $tempValue = trim(substr($entry['text'], $pos, $valLength)); $tempEntry = new NagiosTimeperiodEntry(); $tempEntry->setEntry($tempLabel); $tempEntry->setValue($tempValue); $timePeriod->addNagiosTimeperiodEntry($tempEntry); $tempEntry->clearAllReferences(true); } } } // Check to see if there is an exclusion $excludes = $segment->get("exclude"); if ($excludes) { $val = $excludes[0]['value']; // Multiple timeperiods are seperated by a comma $timeperiods = explode(",", $val); if (count($timeperiods)) { foreach ($timeperiods as $timeperiod) { $timeperiod = trim($timeperiod); $c = new Criteria(); $c->add(NagiosTimeperiodPeer::NAME, $val); $c->setIgnoreCase(true); $target = NagiosTimeperiodPeer::doSelectOne($c); if (!$target) { $job->addLogEntry("Dependent exclude timeperiod " . $timeperiod . " not found. ", ImportLogEntry::TYPE_NOTICE); return false; } else { $exclusion = new NagiosTimeperiodExclude(); $exclusion->setNagiosTimeperiodRelatedByTimeperiodId($timePeriod); $exclusion->setNagiosTimeperiodRelatedByExcludedTimeperiod($target); $exclusion->clearAllReferences(true); $target->clearAllReferences(true); } } } } $timePeriod->save(); $timePeriod->clearAllReferences(true); $job->addNotice("NagiosTimePeriodImporter finished importing timeperiod: " . $timePeriod->getName()); return true; }
} else { $tempGroup = NagiosContactGroupPeer::retrieveByPk($_POST['host_manage']['contactgroup_add']['contactgroup_id']); if ($tempGroup) { $membership = new NagiosHostContactgroup(); $membership->setHost($_GET['id']); $membership->setNagiosContactGroup($tempGroup); $membership->save(); $success = "New Host Contact Group Link added."; } } } else { if ($_POST['request'] == 'parent_add') { // Wants to add a parent $c = new Criteria(); $c->add(NagiosHostPeer::NAME, $_POST['parenthost']); $c->setIgnoreCase(true); $parentHost = NagiosHostPeer::doSelectOne($c); if (!$parentHost) { $error = "The host named " . $_POST['parenthost'] . " was not found."; } else { $tempParent = new NagiosHostParent(); $tempParent->setChildHost($host->getId()); $tempParent->setParentHost($parentHost->getId()); $tempParent->save(); $success = "Parent added"; } } } } } }
protected final function createModulesByHook($hook, $context = null) { $c = new Criteria(); $c->add(AddOnModuleHookPeer::ADD_ON_MODULE, $this->_ormModule->getId()); $c->add(AddOnModuleHookPeer::NAME, $hook); $c->setIgnoreCase(true); $hook = AddOnModuleHookPeer::doSelectOne($c); if (!$hook) { return false; } $registrations = $hook->getAddOnModuleHookRegistrations(); $modules = array(); foreach ($registrations as $registration) { $addOnModule = $registration->getAddOnModuleRelatedByAddOnModule(); if ($addOnModule) { // Okay, let's load up the class. // First, make sure we include the class file. if (!file_exists(dirname(__FILE__) . "/../addons/" . $addOnModule->getAddOnRelatedByAddOn()->getPath() . "/modules/" . $addOnModule->getClassName() . ".php")) { throw new Exception("The module class file for " . $addOnModule->getClassName() . " could not be found."); } require_once dirname(__FILE__) . "/../addons/" . $addOnModule->getAddOnRelatedByAddOn()->getPath() . "/modules/" . $addOnModule->getClassName() . ".php"; $className = $addOnModule->getClassName(); $modules[] = new $className($addOnModule, $context == null ? $this->getContext() : $context, $this); } } return $modules; }
public function executeAutoMessageComplete() { $field = $this->getRequestParameter('field'); $value = $this->getRequestParameter('user_' . $field); //if ($value == null) $value = $this->getRequestParameter('recipient'); $this->forward404Unless($field, 'Either field or value missing'); $this->logMessage('value: [' . $value . ']'); $c = new Criteria(); switch ($field) { case 'recipient': case 'name': $crit1 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, "%" . $value . "%", Criteria::LIKE); $crit2 = $c->getNewCriterion(sfGuardUserProfilePeer::LAST_NAME, "%" . $value . "%", Criteria::LIKE); $crit3 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, 'UPPER(CONCAT(' . sfGuardUserProfilePeer::FIRST_NAME . ', " ", ' . sfGuardUserProfilePeer::LAST_NAME . ')) LIKE UPPER(\'%' . $value . '%\')', Criteria::CUSTOM); // Building an OR statement with propel...not that much fun $crit1->addOr($crit2); $crit1->addOr($crit3); $c->add($crit1); } //$c->addLimit(3); $c->setIgnoreCase(true); $this->searchTerm = $value; $this->results = sfGuardUserProfilePeer::doSelect($c); }
/** * Returns an element filtering its contents * * @return mixed */ public static function filter ( TlalokesRequest &$request ) { try { $page = isset( $request->page ) ? $request->page : 1; $limit = isset( $request->limit ) ? $request->limit : 0; // set Criteria object $c = new Criteria(); $c->setIgnoreCase( true ); // add elements to criteria if ( $request->id ) { $c->add( AuthAccessProfilesRolesPeer::ID, $request->id ); } if ( $request->profile ) { $c->add( AuthAccessProfilesRolesPeer::PROFILE, $request->profile ); } if ( $request->role ) { $c->add( AuthAccessProfilesRolesPeer::ROLE, $request->role ); } if ( $page > 1 && $limit == 0 ) { throw new Exception( "There is no page $page" ); } $pager = new PropelPager( $c, 'AuthAccessProfilesRolesPeer', 'doSelect', $page, $limit ); if ( !$pager->getResult() ) { throw new Exception( 'There are no coincidences' ); } $r['pager']['total_pages'] = $pager->getTotalPages(); $r['pager']['total_records_count'] = $pager->getTotalRecordCount(); $r['pager']['current'] = $pager->getPage(); $r['pager']['next'] = $pager->getNext(); $r['pager']['prev'] = $pager->getPrev(); $r['pager']['limit'] = $limit; foreach ( $pager->getResult() as $obj ) { $r['data'][] = array( 'id' => $obj->getId(), 'profile' => $obj->getAuthAccessProfiles()->getName(), 'role' => $obj->getAuthRoles()->getName() ); } return $r; } catch ( Exception $e ) { return $e->getMessage(); } }
public function executeAutoComplete() { $field = $this->getRequestParameter('field'); $value = $this->getRequestParameter('project_' . $field); $this->forward404Unless($field, 'Either field or value missing'); $c = new Criteria(); switch ($field) { case 'title': $c->add(ProjectPeer::TITLE, "%" . $value . "%", Criteria::LIKE); } //$c->addLimit(3); $c->setIgnoreCase(true); $this->searchTerm = $value; $this->results = ProjectPeer::doSelect($c); }
function addContactGroupByName($name) { $c = new Criteria(); $c->add(NagiosContactGroupPeer::NAME, $name); $c->setIgnoreCase(true); $contactgroup = NagiosContactGroupPeer::doSelectOne($c); if (!$contactgroup) { return false; } // Okay, contactgroup is valid, check for relationship $id = $this->getId(); if (!empty($id)) { $c = new Criteria(); $c->add(NagiosHostContactgroupPeer::HOST_TEMPLATE, $this->getId()); $c->add(NagiosHostContactgroupPeer::CONTACTGROUP, $contactgroup->getId()); $relationship = NagiosHostContactgroupPeer::doSelectOne($c); if ($relationship) { return false; } } $relationship = new NagiosHostContactgroup(); $relationship->setNagiosHostTemplate($this); $relationship->setNagiosContactGroup($contactgroup); $relationship->save(); return true; }
public function valid() { // We need to check to see if we have dependency issues, if so, state we are invalid at this time $segment = $this->getSegment(); $job = $this->getEngine()->getJob(); $val = $segment->get("ocsp_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find ocsp_command command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("ohcp_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find ohcp_command command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("host_perfdata_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find host_perfdata_command command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("service_perfdata_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find service_perfdata_command command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("host_perfdata_file_processing_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find host_perfdata_file_processing_command command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("service_perfdata_file_processing_command"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find service_perfdata_file_processing command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("global_service_event_handler"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find global_service_event_handler command: " . $val); return false; } $command->clearAllReferences(true); } $val = $segment->get("global_host_event_handler"); $val = $val[0]['value']; if ($val) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME, $val); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if (!$command) { $job->addNotice("Main Configuration not yet valid. Could not find global_host_event_handler command: " . $val); return false; } $command->clearAllReferences(true); } return true; }
public function testOrderByIgnoreCaseWithWhereClause() { $originalDB = Propel::getDB(); Propel::setDB(null, new DBMySQL()); $criteria = new Criteria(); $criteria->setIgnoreCase(true); $criteria->addAscendingOrderByColumn(BookPeer::TITLE); $criteria->add('book.title', false); BookPeer::addSelectColumns($criteria); $params = array(); $sql = BasePeer::createSelectSql($criteria, $params); $expectedSQL = 'SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id, UPPER(book.title) FROM `book` WHERE UPPER(book.title)=UPPER(:p1) ORDER BY UPPER(book.title) ASC'; $this->assertEquals($expectedSQL, $sql); Propel::setDB(null, $originalDB); }
public function setServicePerfdataFileProcessingCommandByName($command_name) { $c = new Criteria(); $c->add(NagiosCommandPeer::NAME); $c->setIgnoreCase(true); $command = NagiosCommandPeer::doSelectOne($c); if ($command) { $this->setServicePerfdataFileProcessingCommand($command->getId()); return true; } return false; }