当前位置: 首页>>代码示例>>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;未经允许,请勿转载。