Commit bdafb4be by Luciano Baraglia

Unique indexes rules for single columns into array

parent bd07bc1d
......@@ -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);
......
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