_createTable.php 607 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Creates a call for the method `yii\db\Migration::createTable()`.
  4. */
  5. /* @var $table string the name table */
  6. /* @var $fields array the fields */
  7. /* @var $foreignKeys array the foreign keys */
  8. ?> $this->createTable('<?= $table ?>', [
  9. <?php foreach ($fields as $field):
  10. if (empty($field['decorators'])): ?>
  11. '<?= $field['property'] ?>',
  12. <?php else: ?>
  13. <?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>,
  14. <?php endif;
  15. endforeach; ?>
  16. ]);
  17. <?= $this->render('_addForeignKeys', [
  18. 'table' => $table,
  19. 'foreignKeys' => $foreignKeys,
  20. ]);