mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
@ -615,7 +615,46 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
||||
{
|
||||
$this->on = $condition;
|
||||
$this->addParams($params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an additional ON condition to the existing one.
|
||||
* The new condition and the existing one will be joined using the 'AND' operator.
|
||||
* @param string|array $condition the new ON condition. Please refer to [[where()]]
|
||||
* on how to specify this parameter.
|
||||
* @return static the query object itself
|
||||
* @see onCondition()
|
||||
* @see orOnCondition()
|
||||
*/
|
||||
public function andOnCondition($condition, $params = [])
|
||||
{
|
||||
if ($this->on === null) {
|
||||
$this->on = $condition;
|
||||
} else {
|
||||
$this->on = ['and', $this->on, $condition];
|
||||
}
|
||||
$this->addParams($params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an additional ON condition to the existing one.
|
||||
* The new condition and the existing one will be joined using the 'OR' operator.
|
||||
* @param string|array $condition the new ON condition. Please refer to [[where()]]
|
||||
* on how to specify this parameter.
|
||||
* @return static the query object itself
|
||||
* @see onCondition()
|
||||
* @see andOnCondition()
|
||||
*/
|
||||
public function orOnCondition($condition, $params = [])
|
||||
{
|
||||
if ($this->on === null) {
|
||||
$this->on = $condition;
|
||||
} else {
|
||||
$this->on = ['or', $this->on, $condition];
|
||||
}
|
||||
$this->addParams($params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ trait ActiveQueryTrait
|
||||
*/
|
||||
public $asArray;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the [[asArray]] property.
|
||||
* @param boolean $value whether to return the query results in terms of arrays instead of Active Records.
|
||||
@ -38,7 +39,6 @@ trait ActiveQueryTrait
|
||||
public function asArray($value = true)
|
||||
{
|
||||
$this->asArray = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ trait QueryTrait
|
||||
*/
|
||||
public $indexBy;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the [[indexBy]] property.
|
||||
* @param string|callable $column the name of the column by which the query results should be indexed by.
|
||||
@ -67,7 +68,6 @@ trait QueryTrait
|
||||
public function indexBy($column)
|
||||
{
|
||||
$this->indexBy = $column;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -84,7 +84,6 @@ trait QueryTrait
|
||||
public function where($condition)
|
||||
{
|
||||
$this->where = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -104,7 +103,6 @@ trait QueryTrait
|
||||
} else {
|
||||
$this->where = ['and', $this->where, $condition];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -124,7 +122,6 @@ trait QueryTrait
|
||||
} else {
|
||||
$this->where = ['or', $this->where, $condition];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -144,7 +141,6 @@ trait QueryTrait
|
||||
public function orderBy($columns)
|
||||
{
|
||||
$this->orderBy = $this->normalizeOrderBy($columns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -166,7 +162,6 @@ trait QueryTrait
|
||||
} else {
|
||||
$this->orderBy = array_merge($this->orderBy, $columns);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -184,7 +179,6 @@ trait QueryTrait
|
||||
$result[$column] = SORT_ASC;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -197,7 +191,6 @@ trait QueryTrait
|
||||
public function limit($limit)
|
||||
{
|
||||
$this->limit = $limit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -209,7 +202,6 @@ trait QueryTrait
|
||||
public function offset($offset)
|
||||
{
|
||||
$this->offset = $offset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user