diff --git a/extensions/yii/gii/generators/model/Generator.php b/extensions/yii/gii/generators/model/Generator.php index bcc2ea2..0a00610 100644 --- a/extensions/yii/gii/generators/model/Generator.php +++ b/extensions/yii/gii/generators/model/Generator.php @@ -255,7 +255,7 @@ class Generator extends \yii\gii\Generator foreach ($uniqueIndexes as $indexName => $uniqueColumns) { $attributesCount = count($uniqueColumns); if ($attributesCount == 1) { - $rules[] = "['" . $uniqueColumns[0] . "', 'unique']"; + $rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']"; } elseif ($attributesCount > 1) { $labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns)); $lastLabel = array_pop($labels);