Merge pull request #2504 from thiagotalma/master

Allow add a condition telling the table to avoid ambiguity error.
This commit is contained in:
Qiang Xue
2014-02-23 18:15:45 -05:00

View File

@ -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;
}