mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 18:47:33 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			607 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			607 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| /**
 | |
|  * Creates a call for the method `yii\db\Migration::createTable()`.
 | |
|  */
 | |
| /* @var $table string the name table */
 | |
| /* @var $fields array the fields */
 | |
| /* @var $foreignKeys array 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,
 | |
| ]);
 | 
