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


PHP QueryBuilder::orWhere方法代碼示例

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


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

示例1: restrict

 /**
  * {@inheritdoc}
  */
 public function restrict($expression, $condition = DataSourceInterface::CONDITION_AND)
 {
     switch ($condition) {
         case DataSourceInterface::CONDITION_AND:
             $this->queryBuilder->andWhere($expression);
             break;
         case DataSourceInterface::CONDITION_OR:
             $this->queryBuilder->orWhere($expression);
             break;
     }
 }
開發者ID:sylius,項目名稱:sylius,代碼行數:14,代碼來源:DataSource.php

示例2: where

 public function where($column, $operator = null, $value = null, $boolean = 'and')
 {
     $args = func_get_args();
     if (count($args) == 1) {
         parent::where($args[0]);
         return $this;
     }
     $column = $args[0];
     $boolean = 'and';
     $operator = '=';
     if (count($args) == 2) {
         $value = $args[1];
     }
     if (count($args) == 3) {
         $operator = $args[1];
         $value = $args[2];
     }
     if (count($args) == 4) {
         $operator = $args[1];
         $value = $args[2];
         $boolean = $args[3];
     }
     if (is_array($value)) {
         $operator = $operator == '=' ? 'in' : 'notIn';
         $where_clause = $this->expr()->{$operator}($column, parent::createNamedParameter($value, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY));
     } else {
         $where_clause = $column . $operator . parent::createNamedParameter($value);
     }
     if ($boolean == 'and') {
         parent::andWhere($where_clause);
     } elseif ($boolean == 'or') {
         parent::orWhere($where_clause);
     }
     return $this;
 }
開發者ID:arduanov,項目名稱:pimple-active-record,代碼行數:35,代碼來源:QueryBuilder.php

示例3: filters

 /**
  * @param $tableName
  * @param $conditions
  *
  * @return array
  *
  * @throws LookupError
  *
  * @since 1.1.0
  *
  * @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
  */
 public static function filters(QueryBuilder $queryBuilder, $conditions)
 {
     // default lookup is equal
     $lookup = 'eq';
     // we add the or conditions afterwards to avoid them being mistaken for "and" conditions when they come first
     $or_combine = [];
     $and_combine = [];
     // create where clause from the conditions given
     foreach ($conditions as $condition) {
         foreach ($condition as $key => $value) {
             $column = self::getLookupColumn($key);
             $lookup = self::getLookUP($key);
             $value = self::prepareValue($value, $lookup);
             echo self::$lookuOptions[$lookup] . '<br>';
             echo $queryBuilder->createNamedParameter($value) . '<br>';
             echo $value . '<br>';
             $lookupCondition = sprintf(self::$lookuOptions[$lookup], $queryBuilder->createNamedParameter($value));
             $queryString = sprintf('%s %s', $column, $lookupCondition);
             if (self::combine($key) === self::$or) {
                 $queryBuilder->orWhere($queryString);
             } else {
                 $queryBuilder->andWhere($queryString);
             }
         }
     }
 }
開發者ID:eddmash,項目名稱:powerorm,代碼行數:38,代碼來源:Lookup.php

示例4: processWhereCondition

 protected function processWhereCondition(array $condition, QBuilder $qbuilder)
 {
     $query = $condition['condition'];
     if (stripos($query, '?') === false) {
         $query .= " = ?";
     }
     $type = isset($condition['type']) ? strtoupper($condition['type']) : 'AND';
     if ($type == 'AND') {
         $qbuilder->andWhere($query);
     } else {
         $qbuilder->orWhere($query);
     }
     if (isset($condition['value'])) {
         $this->params[] = $condition['value'];
     }
 }
開發者ID:thoom,項目名稱:dbm,代碼行數:16,代碼來源:QueryBuilder.php

示例5: orWhereDelegatesToConcreteQueryBuilder

 /**
  * @test
  */
 public function orWhereDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->orWhere('uid=1', 'type=9')->shouldBeCalled()->willReturn($this->subject);
     $this->subject->orWhere('uid=1', 'type=9');
 }
開發者ID:dachcom-digital,項目名稱:TYPO3.CMS,代碼行數:8,代碼來源:QueryBuilderTest.php

示例6: orWhere

 /**
  * @param array $conditions
  * @return $this
  */
 public function orWhere($conditions)
 {
     $this->queryBuilder->orWhere($this->clause($conditions));
     return $this;
 }
開發者ID:marcojetson,項目名稱:freckle,代碼行數:9,代碼來源:Query.php

示例7: orWhere

 /**
  * Adds one or more restrictions to the query results, forming a logical
  * disjunction with any previously specified restrictions.
  *
  * @param mixed $where The WHERE statement.
  *
  * @return self
  *
  * @see where()
  */
 public function orWhere($where)
 {
     $this->qb->orWhere($where);
     return $this;
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:15,代碼來源:SqlQueryBuilder.php


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