當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。