本文整理汇总了PHP中Migration::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::config方法的具体用法?PHP Migration::config怎么用?PHP Migration::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Migration
的用法示例。
在下文中一共展示了Migration::config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
protected function _execute(array $params)
{
$db = Database::instance(Database::$default);
Minion_CLI::write('Exporting table structure to structure.sql');
try {
$rows = $db->query(Database::SELECT, 'show tables', FALSE);
$tables = [];
$views = [];
foreach ($rows as $row) {
$table = reset($row);
$res = $db->query(Database::SELECT, 'show create table `' . $table . '`', FALSE);
$res = $res[0];
$schema = Arr::get($res, 'Create Table', NULL);
if ($schema === NULL) {
$schema = Arr::get($res, 'Create View', NULL);
$schema = preg_replace('#^CREATE.*VIEW `#U', 'CREATE VIEW `', $schema);
if ($schema === NULL) {
continue;
}
$views[] = $schema . ';';
continue;
}
$tables[] = $schema . ';';
}
file_put_contents(Migration::config('dump') . 'structure.sql', implode("\n\n", $tables) . "\n\n" . implode("\n\n", $views));
Minion_CLI::write('OK');
} catch (Exception $ex) {
Minion_CLI::write('ERROR: ' . $ex->getMessage());
}
}
示例2: _execute
protected function _execute(array $params)
{
$mask = '*.php';
if ($params['name'] !== NULL) {
$mask = $params['name'] . '.php';
}
$seeds = glob(Migration::config('seeds') . $mask);
if ($seeds !== FALSE && count($seeds)) {
foreach ($seeds as $seed) {
Minion_CLI::write('Seeding \'' . basename($seed, '.php') . '\'');
include $seed;
Minion_CLI::write('OK');
}
} else {
Minion_CLI::write('Nothing to seed');
}
}
示例3: get_class_filename
public function get_class_filename()
{
if ($this->loaded()) {
return Migration::config('path') . $this->hash . '_' . $this->name . '.php';
}
}