mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			629 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			629 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
/**
 | 
						|
 * Creates a call for the method `yii\db\Migration::createTable()`.
 | 
						|
 *
 | 
						|
 * @var \yii\web\View $this
 | 
						|
 * @var string $table the name table
 | 
						|
 * @var array $fields the fields
 | 
						|
 * @var array $foreignKeys the foreign keys
 | 
						|
 */
 | 
						|
 | 
						|
?>        $this->createTable('<?= $table ?>', [
 | 
						|
<?php foreach ($fields as $field):
 | 
						|
    if (empty($field['decorators'])): ?>
 | 
						|
            '<?= $field['property'] ?>',
 | 
						|
<?php else: ?>
 | 
						|
            <?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>,
 | 
						|
<?php endif;
 | 
						|
endforeach; ?>
 | 
						|
        ]);
 | 
						|
<?= $this->render('_addForeignKeys', [
 | 
						|
    'table' => $table,
 | 
						|
    'foreignKeys' => $foreignKeys,
 | 
						|
]);
 |