本文整理汇总了PHP中BaseController::handle方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseController::handle方法的具体用法?PHP BaseController::handle怎么用?PHP BaseController::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseController
的用法示例。
在下文中一共展示了BaseController::handle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
public function handle($request)
{
parent::handle($request);
$this->loadMigrationParameters();
$filename = 'db-migration.yml';
$source = __DIR__ . '/../../../' . $filename;
$dest = getcwd() . '/' . $filename;
if (!is_file($dest)) {
if (copy($source, $dest)) {
echo "{$filename} is created\n";
} else {
throw new \Exception("Can't create {$filename}. Check permissions?");
}
} else {
echo "{$filename} already exists\n";
}
foreach ($this->app->parameters['migrations'] as $path) {
echo $path . ' ';
if (!is_dir(getcwd() . '/' . $path)) {
if (mkdir($path, 0777, true)) {
echo "created\n";
} else {
throw new \Exception("Can't create migrations folder. Check permissions?");
}
} else {
echo "already exists\n";
}
}
}
示例2: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$date = date('Y-m-d');
$number = 1;
$last_migration = $this->getLastMigrationParsedId();
if ($last_migration) {
if ($date == $last_migration['date']) {
$number = $last_migration['number'] + 1;
}
}
$migration_filename = sprintf('%s-%s', $date, str_pad($number, 3, '0', STR_PAD_LEFT));
$words = $this->app->parameters['_words_'];
$name = false;
if (isset($words[2])) {
$name = $words[2];
}
if ($name !== false) {
$name = preg_replace('/[^\\w]/', '-', $name);
$migration_filename .= '-' . $name;
}
$migration_filename .= '.' . $this->app->parameters['migration-file-extention'];
$migration_fullname = $this->app->parameters['pwd'] . $this->app->parameters['migrations'][0] . $migration_filename;
if (file_put_contents($migration_fullname, '') !== false) {
echo "Created empty migration file {$migration_filename}\n";
} else {
throw new \Exception('Can\'t create new migration file');
}
}
示例3: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$migrations = $this->app->getTrackedMigrations();
foreach ($migrations as $migration) {
if ($migration->status == 'new') {
$this->printMigration($migration);
}
}
}
示例4: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$limit = null;
$words = $this->app->parameters['_words_'];
if (isset($words[2])) {
$limit = $words[2];
}
$migrations = $this->app->getTrackedMigrations($limit);
foreach ($migrations as $migration) {
$this->printMigration($migration);
}
}
示例5: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$migrations = $this->app->getTrackedMigrations();
$tracker = $this->app->getTracker();
$cnt = 0;
foreach ($migrations as $migration) {
if (!in_array($migration->status, array('new', 'migrated'))) {
$this->printMigration($migration);
$tracker->delete($migration);
$cnt++;
}
}
echo "All unlocked\n";
}
示例6: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$migrations = $this->app->getTrackedMigrations();
$tracker = $this->app->getTracker();
$cnt = 0;
foreach ($migrations as $migration) {
$this->printMigration($migration);
if ($migration->status == 'new') {
$tracker->register($migration);
$tracker->setStatus($migration, 'migrated');
echo "Marked as migrated\n";
}
$cnt++;
}
echo "All migrated\n";
}
示例7: handle
public function handle($request)
{
parent::handle($request);
$this->initTracker();
$mirations = $this->app->getTrackedMigrations();
$tracker = $this->app->getTracker();
$cnt = 0;
$words = $this->app->parameters['_words_'];
if (!isset($words[2])) {
throw new \Exception("Must specify migration id", 1);
}
$reset_id = $words[2];
foreach ($mirations as $migration) {
if ($migration->id == $reset_id) {
$this->printMigration($migration);
$tracker->delete($migration);
$cnt++;
}
}
if ($cnt == 0) {
throw new \Exception("migration not found '{$reset_id}'", 1);
}
}