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