|
|
@ -190,9 +190,9 @@ class Generator extends \yii\gii\Generator |
|
|
|
} |
|
|
|
} |
|
|
|
$column = $tableSchema->columns[$attribute]; |
|
|
|
$column = $tableSchema->columns[$attribute]; |
|
|
|
if ($column->phpType === 'boolean') { |
|
|
|
if ($column->phpType === 'boolean') { |
|
|
|
return "\$form->field(\$model, '$attribute')->checkbox();"; |
|
|
|
return "\$form->field(\$model, '$attribute')->checkbox()"; |
|
|
|
} elseif ($column->type === 'text') { |
|
|
|
} elseif ($column->type === 'text') { |
|
|
|
return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6]);"; |
|
|
|
return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6])"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) { |
|
|
|
if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) { |
|
|
|
$input = 'passwordInput'; |
|
|
|
$input = 'passwordInput'; |
|
|
@ -200,9 +200,9 @@ class Generator extends \yii\gii\Generator |
|
|
|
$input = 'textInput'; |
|
|
|
$input = 'textInput'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($column->phpType !== 'string' || $column->size === null) { |
|
|
|
if ($column->phpType !== 'string' || $column->size === null) { |
|
|
|
return "\$form->field(\$model, '$attribute')->$input();"; |
|
|
|
return "\$form->field(\$model, '$attribute')->$input()"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return "\$form->field(\$model, '$attribute')->$input(['maxlength' => $column->size]);"; |
|
|
|
return "\$form->field(\$model, '$attribute')->$input(['maxlength' => $column->size])"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -216,9 +216,9 @@ class Generator extends \yii\gii\Generator |
|
|
|
$tableSchema = $this->getTableSchema(); |
|
|
|
$tableSchema = $this->getTableSchema(); |
|
|
|
$column = $tableSchema->columns[$attribute]; |
|
|
|
$column = $tableSchema->columns[$attribute]; |
|
|
|
if ($column->phpType === 'boolean') { |
|
|
|
if ($column->phpType === 'boolean') { |
|
|
|
return "\$form->field(\$model, '$attribute')->checkbox();"; |
|
|
|
return "\$form->field(\$model, '$attribute')->checkbox()"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return "\$form->field(\$model, '$attribute');"; |
|
|
|
return "\$form->field(\$model, '$attribute')"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|