mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-08 17:07:33 +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)
|
||||
{
|
||||
$value = $this->$attribute;
|
||||
if (($pos = strrpos($attribute, '.')) !== false) {
|
||||
$modelAttribute = substr($attribute, $pos + 1);
|
||||
} else {
|
||||
$modelAttribute = $attribute;
|
||||
}
|
||||
|
||||
$value = $this->$modelAttribute;
|
||||
if (trim($value) === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user