Allow add a condition telling the table to avoid ambiguity error.

This commit is contained in:
Thiago Talma
2014-02-20 17:20:10 -03:00
parent 0d720e0695
commit ba9f5d6521

View File

@ -69,7 +69,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;
}