diff --git a/extensions/gii/generators/crud/templates/search.php b/extensions/gii/generators/crud/templates/search.php index ba8ea0e..986250e 100644 --- a/extensions/gii/generators/crud/templates/search.php +++ b/extensions/gii/generators/crud/templates/search.php @@ -72,7 +72,13 @@ class 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; }