mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-09 01:27:20 +08:00
Merge pull request #2504 from thiagotalma/master
Allow add a condition telling the table to avoid ambiguity error.
This commit is contained in:
@ -72,7 +72,13 @@ class <?= $searchModelClass ?> extends Model
|
|||||||
|
|
||||||
protected function addCondition($query, $attribute, $partialMatch = false)
|
protected function addCondition($query, $attribute, $partialMatch = false)
|
||||||
{
|
{
|
||||||
$value = $this->$attribute;
|
if (($pos = strrpos($attribute, '.')) !== false) {
|
||||||
|
$modelAttribute = substr($attribute, $pos + 1);
|
||||||
|
} else {
|
||||||
|
$modelAttribute = $attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $this->$modelAttribute;
|
||||||
if (trim($value) === '') {
|
if (trim($value) === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user