當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Criteria::addOr方法代碼示例

本文整理匯總了PHP中Criteria::addOr方法的典型用法代碼示例。如果您正苦於以下問題:PHP Criteria::addOr方法的具體用法?PHP Criteria::addOr怎麽用?PHP Criteria::addOr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Criteria的用法示例。


在下文中一共展示了Criteria::addOr方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: retrieveByUri

 /**
  * description
  *
  * @return Schema
  *
  * @param string $uri
  *
  */
 public static function retrieveByUri($uri)
 {
     $criteria = new Criteria();
     $criteria->add(self::URI, $uri);
     $criteria->addOr(self::URI, $uri . "#");
     $criteria->addOr(self::URI, $uri . "/");
     return self::doSelectOne($criteria);
 }
開發者ID:jonphipps,項目名稱:Metadata-Registry,代碼行數:16,代碼來源:SchemaPeer.php

示例2: createSearchCriteria

 function createSearchCriteria($phrase, $where = false)
 {
     $c = new Criteria();
     if ($phrase) {
         $rawPhrase = addslashes($phrase);
         $phrase = strtr($phrase, '+-><()~*"', ' ');
         $words = preg_split("#\\s+#", $phrase);
         $booleanOperator = Config::get("searchEngineWordDefaultOperator") == "AND" ? "+" : "";
         $phrase = $booleanOperator . implode(" " . $booleanOperator, $words);
         $phrase = addslashes($phrase);
         $searchEngineSearchInFields = explode("|", Config::get("searchEngineSearchIn"));
         $fullTextSearchFields = array("siteTitle", "description");
         $searchInFields = "";
         foreach ($fullTextSearchFields as $field) {
             if (in_array($field, $searchEngineSearchInFields)) {
                 if ($searchInFields) {
                     $searchInFields .= ", ";
                 }
                 $searchInFields .= $field;
             }
         }
         if ($searchInFields) {
             $cc = new Criteria();
             $cc->add("MATCH ({$searchInFields}) AGAINST ('{$phrase}' IN BOOLEAN MODE)");
             $searchEngineLikeMethodEnabled = Config::get('searchEngineLikeMethodEnabled');
             $searchEngineLikeMethodWordMinLength = Config::get('searchEngineLikeMethodWordMinLength');
             $searchEngineLikeMethodWordMaxLength = Config::get('searchEngineLikeMethodWordMaxLength');
             if ($searchEngineLikeMethodEnabled) {
                 $conjunction = Config::get("searchEngineWordDefaultOperator") == 'AND' ? 'AND' : 'OR';
                 foreach ($words as $word) {
                     $strlen = strlen($word);
                     if ($strlen <= $searchEngineLikeMethodWordMaxLength && $strlen >= $searchEngineLikeMethodWordMinLength) {
                         foreach ($fullTextSearchFields as $field) {
                             if (in_array($field, $searchEngineSearchInFields)) {
                                 $cc->add($field, "%" . str_replace(array("%", "?"), "", $word) . "%", "LIKE", $conjunction);
                             }
                         }
                     }
                 }
             }
             if (in_array("url", $searchEngineSearchInFields)) {
                 $cc->addOr("LOCATE( '{$rawPhrase}', url ) > 0 ");
             }
             $c->add($cc);
         }
     }
     if ($where) {
         $rawWhere = addslashes($where);
         $c2 = new Criteria();
         $c2->addOr("LOCATE( '{$rawWhere}', address ) > 0 ");
         $c2->addOr("LOCATE( '{$rawWhere}', city ) > 0 ");
         $c2->addOr("LOCATE( '{$rawWhere}', zipCode ) > 0 ");
         $c->add($c2);
     }
     return $c;
 }
開發者ID:reinfire,項目名稱:arfooo,代碼行數:56,代碼來源:SiteSearcherModel.php

示例3: retrieveByUri

 /**
  * description
  *
  * @return return_type
  * @param  var_type $var
  */
 public static function retrieveByUri($uri)
 {
     $con = Propel::getConnection(self::DATABASE_NAME);
     $criteria = new Criteria(VocabularyPeer::DATABASE_NAME);
     $criteria->add(self::URI, $uri);
     $criteria->addOr(self::URI, $uri . "#");
     $criteria->addOr(self::URI, $uri . "/");
     $v = VocabularyPeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }
開發者ID:jonphipps,項目名稱:Metadata-Registry,代碼行數:16,代碼來源:VocabularyPeer.php

示例4: del

 function del(Criteria $c)
 {
     $condition = $c->getCondition("categoryId");
     $categoryId = $condition['value'];
     $childCategoriesIds = array_map(create_function('$category', 'return $category[\'categoryId\'];'), $this->getChilds($categoryId, true));
     $parentIds = array_map(create_function('$category', 'return $category[\'categoryId\'];'), $this->getParents($categoryId));
     //creating list of items to delete
     $c = new Criteria();
     $c->add("categoryId", $childCategoriesIds, "IN");
     $itemIds = $this->site->getArray($c, "siteId", false);
     //delete all categories and subcategoeis
     $c = new Criteria();
     $c->add("categoryId", $childCategoriesIds, "IN");
     parent::del($c);
     $this->extraFieldCategory->del($c);
     $c = new Criteria();
     $c->add("childId", $childCategoriesIds, "IN");
     $c->addOr("parentId", $childCategoriesIds, "IN");
     $this->categoryParent->del($c);
     //deleting items
     foreach ($itemIds as $itemId) {
         $c = new Criteria();
         $c->add("siteId", $itemId);
         $this->site->del($c, false);
     }
     $this->updateValidatedSitesCount($parentIds);
     Cacher::getInstance()->clean("tag", array("category", "site"));
 }
開發者ID:reinfire,項目名稱:arfooo,代碼行數:28,代碼來源:CategoryModel.php

示例5: getEmailAccounts

 public function getEmailAccounts()
 {
     $criteria = new Criteria();
     $criteria->add(self::STATUS, 'activated');
     $criteria->addOr(self::STATUS, 'disactivated');
     return self::doSelect($criteria);
 }
開發者ID:habtom,項目名稱:uas,代碼行數:7,代碼來源:UserPeer.php

示例6: setAdOnPage

 function setAdOnPage($data)
 {
     $c = new Criteria();
     $c->add("page", $data['page']);
     $c->add("place", $data['place']);
     if ($data['adCriterionId'] == 0 && !in_array($data['place'], array("general", "predefine"))) {
         $this->del($c);
     } else {
         $ad = $this->ad->find($c);
         if ($ad) {
             $ad->adCriterionId = $data['adCriterionId'];
             $ad->save();
         } else {
             $ad = new AdRecord();
             $ad->fromArray($data);
             $ad->save();
         }
     }
     //if globall switch was set delete category specified settings
     if ($data['place'] == "general" && preg_match("#^predefine(Category|Site|Keyword|Letter|Tag)#", $data['page'], $match)) {
         $pagePrefix = strtolower($match[1]);
         $c = new Criteria();
         $c->add("page LIKE '{$pagePrefix}%'");
         $c2 = new Criteria();
         $c2->add("place", "general");
         $c2->addOr("place", "predefine");
         $c->add($c2);
         $this->del($c);
     }
 }
開發者ID:reinfire,項目名稱:arfooo,代碼行數:30,代碼來源:AdModel.php

示例7: getCriterioNoBorrado

 public static function getCriterioNoBorrado($atributo)
 {
     $c = new Criteria();
     $c->add($atributo, null, Criteria::ISNULL);
     $c->addOr($atributo, '0000-00-00 00:00:00', Criteria::EQUAL);
     return $c;
 }
開發者ID:Esleelkartea,項目名稱:legedia-ESLE,代碼行數:7,代碼來源:UsuarioPeer.php

示例8: calculate

 public function calculate($user)
 {
     $c = new Criteria();
     $c->add('user_id', $user->getUserId());
     $c->addOr('target_user_id', $user->getUserId());
     $count = DB_ContactPeer::instance()->selectCount($c);
     return $count;
 }
開發者ID:jbzdak,項目名稱:wikidot,代碼行數:8,代碼來源:NumberContacts.php

示例9: executeAbout

 public function executeAbout(sfWebRequest $request)
 {
     $c = new Criteria();
     //1,2,4,5,6,7
     $c->add(sfGuardUserPeer::ID, 1);
     $c->addOr(sfGuardUserPeer::ID, 2);
     $c->addOr(sfGuardUserPeer::ID, 4);
     $c->addOr(sfGuardUserPeer::ID, 5);
     $c->addOr(sfGuardUserPeer::ID, 22);
     $c->addOr(sfGuardUserPeer::ID, 7);
     $c->addOr(sfGuardUserPeer::ID, 31);
     $c->addOr(sfGuardUserPeer::ID, 180);
     $c->addOr(sfGuardUserPeer::ID, 9);
     $c->addOr(sfGuardUserPeer::ID, 738);
     $c->addOr(sfGuardUserPeer::ID, 27);
     $c->addOr(sfGuardUserPeer::ID, 447);
     $c->addAscendingOrderByColumn(sfGuardUserPeer::ID);
     $users = sfGuardUserPeer::doSelect($c);
     $this->users = array();
     foreach ($users as $user) {
         $this->users[$user->getid()] = $user;
     }
     $this->title = sfContext::getInstance()->getI18N()->__('Sobre Voota - Quiénes somos', array());
     $this->response->setTitle($this->title);
 }
開發者ID:voota,項目名稱:voota,代碼行數:25,代碼來源:actions.class.php

示例10: getDueDate

 public function getDueDate()
 {
     $c = new Criteria();
     $c->add(CirHistoryPeer::COL_ITEM_ID, $this->getId());
     $c->add(CirHistoryPeer::RETURN_DATE, null, Criteria::EQUAL);
     $c->addOr(CirHistoryPeer::RETURN_DATE, '', Criteria::EQUAL);
     $ch = CirHistoryPeer::doSelectOne($c);
     return $ch->getDueDate('d-m-Y H:i:s');
 }
開發者ID:taryono,項目名稱:school,代碼行數:9,代碼來源:ColItem.php

示例11: countValidCourseSubjectStudentMarks

 public function countValidCourseSubjectStudentMarks()
 {
     $c = new Criteria();
     $criterion = $c->getNewCriterion(CourseSubjectStudentMarkPeer::IS_FREE, true, Criteria::EQUAL);
     $criterion->addOr($c->getNewCriterion(CourseSubjectStudentMarkPeer::IS_CLOSED, true, Criteria::EQUAL));
     $criterion->addOr($c->getNewCriterion(CourseSubjectStudentMarkPeer::MARK, null, Criteria::ISNOTNULL));
     $c->addOr($criterion);
     return $this->countCourseSubjectStudentMarks($c);
 }
開發者ID:nvidela,項目名稱:kimkelen,代碼行數:9,代碼來源:CourseSubjectStudent.php

示例12: getTestHijos

 public static function getTestHijos($padres)
 {
     $criteria = new Criteria();
     foreach ($padres as $padre) {
         $criteria->addOr(TestsPeer::TESTS_ID, $padre->getTests()->getId(), Criteria::IN);
     }
     $criteria->addAscendingOrderByColumn(self::TITULO);
     return self::doSelectJoinAll($criteria);
 }
開發者ID:qwerfaqs,項目名稱:psicotest,代碼行數:9,代碼來源:TestsPeer.php

示例13: getUnusedPaidOne

 public function getUnusedPaidOne($c)
 {
     $c2 = new Criteria();
     $c2->add("status", "paid");
     $c2->addOr("status", "pending");
     $c->add($c2);
     $c->add("used", 0);
     $c->addOrder("paymentId");
     return $this->find($c);
 }
開發者ID:reinfire,項目名稱:arfooo,代碼行數:10,代碼來源:PaymentModel.php

示例14: getFilesByExternalKeys

 public static function getFilesByExternalKeys($filedescs)
 {
     $fileCriteria = new Criteria();
     sfContext::getInstance()->getLogger()->info('foobar: build criteria start');
     foreach ($filedescs as $key => $file) {
         $tracknr = $file->getTracknr();
         $fileCriteria->addOr($fileCriteria->getNewCriterion(FilePeer::EXTERNAL_KEY, $tracknr));
     }
     sfContext::getInstance()->getLogger()->info('foobar: build criteria done');
     $files = FilePeer::doSelect($fileCriteria);
     sfContext::getInstance()->getLogger()->info('foobar: query finished');
     return $files;
 }
開發者ID:EQ4,項目名稱:smint,代碼行數:13,代碼來源:FilePeer.php

示例15: testAddOrEmptyCriteria

 public function testAddOrEmptyCriteria()
 {
     $table1 = "myTable1";
     $column1 = "myColumn1";
     $value1 = "myValue1";
     $key1 = "{$table1}.{$column1}";
     $this->c->addOr($key1, $value1, Criteria::EQUAL);
     $expect = "SELECT  FROM myTable1 WHERE myTable1.myColumn1=:p1";
     $params = array();
     $result = BasePeer::createSelectSql($this->c, $params);
     $expect_params = array(array('table' => 'myTable1', 'column' => 'myColumn1', 'value' => 'myValue1'));
     $this->assertEquals($expect, $result, 'addOr() called on an empty Criteria adds a criterion to the criteria');
     $this->assertEquals($expect_params, $params, 'addOr() called on an empty Criteria adds a criterion to the criteria');
 }
開發者ID:pkdevbox,項目名稱:mootools-forge,代碼行數:14,代碼來源:CriteriaTest.php


注:本文中的Criteria::addOr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。