public function createMigration($name, $file_extension)
	{
		if ( preg_replace('/[a-z\d\._]/', '', $name) ) {
			throw new \InvalidArgumentException(
				'The migration name can consist only from alpha-numeric characters, as well as dots and underscores.'
			);
		}

		if ( !in_array($file_extension, $this->getMigrationFileExtensions()) ) {
			throw new \InvalidArgumentException(
				'The migration runner for "' . $file_extension . '" file extension is not registered.'
			);
		}

		$migration_file = $this->_migrationsDirectory . '/' . date('Ymd_Hi') . '_' . $name . '.' . $file_extension;

		if ( file_exists($migration_file) ) {
			throw new \LogicException('The migration file "' . basename($migration_file) . '" already exists.');
		}

		file_put_contents($migration_file, $this->_migrationRunners[$file_extension]->getTemplate());

		return basename($migration_file);
	}
public function createMigration($name, $file_extension)
	{
		if ( preg_replace('/[a-z\d\._]/', '', $name) ) {
			throw new \InvalidArgumentException(
				'The migration name can consist only from alpha-numeric characters, as well as dots and underscores.'
			);
		}

		if ( !in_array($file_extension, $this->getMigrationFileExtensions()) ) {
			throw new \InvalidArgumentException(
				'The migration runner for "' . $file_extension . '" file extension is not registered.'
			);
		}

		$migration_file = $this->_migrationsDirectory . '/' . date('Ymd_Hi') . '_' . $name . '.' . $file_extension;

		if ( file_exists($migration_file) ) {
			throw new \LogicException('The migration file "' . basename($migration_file) . '" already exists.');
		}

		file_put_contents($migration_file, $this->_migrationRunners[$file_extension]->getTemplate());

		return basename($migration_file);
	}
public function createMigration ( $ name , $ file_extension ) { if ( preg_replace ( '/[a-z\d\._]/' , '' , $ name ) ) { throw new \ InvalidArgumentException ( 'The migration name can consist only from alpha-numeric characters, as well as dots and underscores.' ) ; } if ( ! in_array ( $ file_extension , $ this -> getMigrationFileExtensions ( ) ) ) { throw new \ InvalidArgumentException ( 'The migration runner for "' . $ file_extension . '" file extension is not registered.' ) ; } $ migration_file = $ this -> _migrationsDirectory . '/' . date ( 'Ymd_Hi' ) . '_' . $ name . '.' . $ file_extension ; if ( file_exists ( $ migration_file ) ) { throw new \ LogicException ( 'The migration file "' . basename ( $ migration_file ) . '" already exists.' ) ; } file_put_contents ( $ migration_file , $ this -> _migrationRunners [ $ file_extension ] -> getTemplate ( ) ) ; return basename ( $ migration_file ) ; }
Creates new migration.

@param string $name           Migration name.
@param string $file_extension Migration file extension.

@return string
@throws \InvalidArgumentException When migration name/file extension is invalid.
@throws \LogicException When new migration already exists.
Creates new migration .