当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseController::handle方法代码示例

本文整理汇总了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";
         }
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:29,代码来源:InitController.php

示例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');
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:30,代码来源:CreateController.php

示例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);
         }
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:11,代码来源:NewController.php

示例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);
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:14,代码来源:ListController.php

示例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";
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:16,代码来源:ResetLocksController.php

示例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";
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:18,代码来源:AllMigratedController.php

示例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);
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:23,代码来源:ResetController.php


注:本文中的BaseController::handle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。