本文整理汇总了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;
}
}
示例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;
}
示例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);
}
}
}
}
示例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'];
}
}
示例5: orWhereDelegatesToConcreteQueryBuilder
/**
* @test
*/
public function orWhereDelegatesToConcreteQueryBuilder()
{
$this->concreteQueryBuilder->orWhere('uid=1', 'type=9')->shouldBeCalled()->willReturn($this->subject);
$this->subject->orWhere('uid=1', 'type=9');
}
示例6: orWhere
/**
* @param array $conditions
* @return $this
*/
public function orWhere($conditions)
{
$this->queryBuilder->orWhere($this->clause($conditions));
return $this;
}
示例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;
}