From bdafb4becb1df20c459ad3d3fe4476d397b6c018 Mon Sep 17 00:00:00 2001 From: Luciano Baraglia Date: Thu, 26 Dec 2013 02:43:35 -0300 Subject: [PATCH] Unique indexes rules for single columns into array --- extensions/yii/gii/generators/model/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);