abstract class AbstractCommand extends Command

数据库迁移-抽象命令

Constants

DEFAULT_MIGRATION_TEMPLATE

The location of the default migration template.

DEFAULT_SEED_TEMPLATE

The location of the default seed template.

Properties

protected Console $console Console实例 from Command
protected Config $config
protected AdapterInterface $adapter
protected Manager $manager

Methods

__construct(Console $console)

Command constructor.

from Command
execute(array $args, array $options = [])

命令的入口方法

from Command
string
format(string $text, array $option = [])

格式化文本

from Command
$this
write(string $text, array $option = [])

格式化输出

from Command
$this
writeln(string $text, array $option = [])

格式化输出

from Command
bootstrap(array $args, array $options = [])

Bootstrap Phinx.

setConfig(Config $config)

Sets the config.

Config
getConfig()

Gets the config.

setAdapter(AdapterInterface $adapter)

Sets the database adapter.

AdapterInterface
getAdapter()

Gets the database adapter.

setManager(Manager $manager)

Sets the migration manager.

Manager
getManager()

Gets the migration manager.

void
loadConfig(array $options)

Parse the config file and load it into the config object

loadManager(array $args, array $options)

Load the migrations manager and inject the config

void
verifyMigrationDirectory(string $path)

Verify that the migration directory exists and is writable.

void
verifySeedDirectory(string $path)

Verify that the seed directory exists and is writable.

string
getMigrationTemplateFilename()

Returns the migration template filename.

string
getSeedTemplateFilename()

Returns the seed template filename.

Details

in Command at line 35
__construct(Console $console)

Command constructor.

Parameters

Console $console

in Command at line 46
abstract execute(array $args, array $options = [])

命令的入口方法

Parameters

array $args 传递给命令的参数
array $options 传递给命令的选项

in Command at line 56
string format(string $text, array $option = [])

格式化文本

Parameters

string $text 要格式化的文本
array $option 格式化选项 see Format

Return Value

string

in Command at line 70
$this write(string $text, array $option = [])

格式化输出

Parameters

string $text 要输出的内容
array $option 格式化选项 see Format

Return Value

$this

in Command at line 84
$this writeln(string $text, array $option = [])

格式化输出

Parameters

string $text 要输出的内容
array $option 格式化选项 see Format

Return Value

$this

at line 60
bootstrap(array $args, array $options = [])

Bootstrap Phinx.

Parameters

array $args
array $options

at line 108
AbstractCommand setConfig(Config $config)

Sets the config.

Parameters

Config $config

Return Value

AbstractCommand

at line 119
Config getConfig()

Gets the config.

Return Value

Config

at line 130
AbstractCommand setAdapter(AdapterInterface $adapter)

Sets the database adapter.

Parameters

AdapterInterface $adapter

Return Value

AbstractCommand

at line 141
AdapterInterface getAdapter()

Gets the database adapter.

Return Value

AdapterInterface

at line 152
AbstractCommand setManager(Manager $manager)

Sets the migration manager.

Parameters

Manager $manager

Return Value

AbstractCommand

at line 163
Manager getManager()

Gets the migration manager.

Return Value

Manager

at line 177
protected void loadConfig(array $options)

Parse the config file and load it into the config object

Parameters

array $options 选项

Return Value

void

Exceptions

InvalidArgumentException

at line 196
protected loadManager(array $args, array $options)

Load the migrations manager and inject the config

Parameters

array $args
array $options

at line 212
protected void verifyMigrationDirectory(string $path)

Verify that the migration directory exists and is writable.

Parameters

string $path

Return Value

void

Exceptions

InvalidArgumentException

at line 237
protected void verifySeedDirectory(string $path)

Verify that the seed directory exists and is writable.

Parameters

string $path

Return Value

void

Exceptions

InvalidArgumentException

at line 259
protected string getMigrationTemplateFilename()

Returns the migration template filename.

Return Value

string

at line 269
protected string getSeedTemplateFilename()

Returns the seed template filename.

Return Value

string