Commit 9eb164f4 by Alexander Makarov

Merge pull request #2101 from thiagotalma/master

Best way to get the labels to search, the existing model.
parents d81f4811 e299b78a
......@@ -305,8 +305,13 @@ class Generator extends \yii\gii\Generator
*/
public function generateSearchLabels()
{
$model = new $this->modelClass();
$attributeLabels = $model->attributeLabels();
$labels = [];
foreach ($this->getColumnNames() as $name) {
if (isset($attributeLabels[$name])) {
$labels[$name] = $attributeLabels[$name];
} else {
if (!strcasecmp($name, 'id')) {
$labels[$name] = 'ID';
} else {
......@@ -317,6 +322,7 @@ class Generator extends \yii\gii\Generator
$labels[$name] = $label;
}
}
}
return $labels;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment