Exemplo n.º 1
0
 public function rules()
 {
     $rules = ArrayHelper::merge(parent::rules(), [[['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['fields'], MultipleModelValidator::className(), 'baseModel' => Field::className()], [['autoCreateTable', 'useTablePrefix', 'tableNameRequired', 'dropIfExists'], 'boolean'], [['migrationPath', 'migrationCreate', 'migrationName'], 'safe'], [['primaryKeyName', 'fileName'], 'string', 'max' => 20], [['fields'], 'default', 'value' => [new Field(['type' => Schema::TYPE_PK, 'name' => $this->primaryKeyName])]], [['fields'], 'safe']]);
     if ($this->tableNameRequired || $this->autoCreateTable) {
         $rules[] = ['tableName', 'required'];
     }
     return $rules;
 }
Exemplo n.º 2
0
 public function rules()
 {
     $rules = ArrayHelper::merge(parent::rules(), [[['tableName'], 'required'], [['tableName'], 'match', 'pattern' => '/^(\\w+\\.)?([\\w\\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'], [['fields'], MultipleModelValidator::className(), 'baseModel' => Field::className()], [['useTablePrefix'], 'boolean'], [['migrationPath', 'migrationName'], 'safe']]);
     return $rules;
 }
Exemplo n.º 3
0
if (!in_array('createMigration', $notVisible)) {
    echo $form->field($generator, $addition . 'createMigration')->checkbox();
}
if (!in_array('autoCreateTable', $notVisible)) {
    echo $form->field($generator, $addition . 'autoCreateTable')->checkbox();
}
if (!in_array('useTablePrefix', $notVisible)) {
    echo $form->field($generator, $addition . 'useTablePrefix')->checkbox();
}
if (!in_array('dropIfExists', $notVisible)) {
    echo $form->field($generator, $addition . 'dropIfExists')->checkbox();
}
if (!$emptyBox) {
    Box::end();
}
Box::begin(['type' => Box::TYPE_PRIMARY, 'withBorder' => true, 'title' => $titleBox, 'collapse' => true]);
if (!in_array('migrationName', $notVisible)) {
    echo $form->field($generator, $addition . 'migrationName')->hiddenInput()->label(false);
}
if (!in_array('tableName', $notVisible)) {
    echo $form->field($generator, $addition . 'tableName');
}
Box::begin(['type' => Box::TYPE_PRIMARY, 'withBorder' => true, 'title' => 'Input columns origin table', 'collapse' => true]);
echo $form->field($generator, $addition . 'fields')->widget(\infinitydevphp\MultipleModelValidator\widgets\MultipleInput::className(), ['attributeOptions' => ['enableAjaxValidation' => false, 'enableClientValidation' => true, 'validateOnChange' => true, 'validateOnSubmit' => true, 'validateOnBlur' => true], 'data' => $generator->fields, 'baseModel' => \infinitydevphp\gii\models\Field::className(), 'columns' => [['name' => 'name', 'enableError' => true, 'title' => 'Name'], ['name' => 'type', 'type' => \kartik\widgets\Select2::className(), 'options' => ['data' => \infinitydevphp\gii\models\Field::getTypes()], 'title' => 'Type'], ['name' => 'length', 'enableError' => true, 'title' => 'Length'], ['name' => 'isCompositeKey', 'enableError' => true, 'type' => 'checkbox', 'title' => 'Composite PK'], ['name' => 'is_not_null', 'enableError' => true, 'type' => 'checkbox', 'title' => 'Is Not Null'], ['name' => 'is_unique', 'enableError' => true, 'type' => 'checkbox', 'title' => 'Unique'], ['name' => 'unsigned', 'enableError' => true, 'type' => 'checkbox', 'title' => 'Unsigned'], ['name' => 'comment', 'enableError' => true, 'title' => 'Comment'], ['name' => 'default', 'enableError' => true, 'title' => 'Default Value'], ['name' => 'precision', 'enableError' => true, 'title' => 'Precision'], ['name' => 'scale', 'enableError' => true, 'title' => 'Scale'], ['name' => 'fk_name', 'enableError' => true, 'title' => 'FK Name'], ['name' => 'related_table', 'enableError' => true, 'title' => 'Related table'], ['name' => 'related_field', 'enableError' => true, 'title' => 'Related field']]]);
Box::end();
Box::end();
?>

<script>

</script>