/**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->i18n->translations['extensions-manager'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages'];
     DeferredQueueEvent::on(DeferredController::className(), DeferredController::EVENT_DEFERRED_QUEUE_COMPLETE, [DeferredQueueCompleteHandler::className(), 'handleEvent']);
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap['extension'] = ExtensionController::className();
         $app->on(Application::EVENT_BEFORE_ACTION, function () {
             $module = ExtensionsManager::module();
             if ($module->autoDiscoverMigrations === true) {
                 if (isset(Yii::$app->params['yii.migrations']) === false) {
                     Yii::$app->params['yii.migrations'] = [];
                 }
                 /** @var array $extensions */
                 $extensions = $module->getExtensions();
                 foreach ($extensions as $name => $ext) {
                     if ($ext['composer_type'] === Extension::TYPE_DOTPLANT && $module->discoverDotPlantMigrations === false) {
                         continue;
                     }
                     $extData = ComposerInstalledSet::get()->getInstalled($ext['composer_name']);
                     $packageMigrations = ExtensionDataHelper::getInstalledExtraData($extData, 'migrationPath', true);
                     $packagePath = '@vendor/' . $ext['composer_name'];
                     foreach ($packageMigrations as $migrationPath) {
                         Yii::$app->params['yii.migrations'][] = "{$packagePath}/{$migrationPath}";
                     }
                 }
             }
         });
     }
 }
 /**
  * @depends testInstalledGetType
  * @param array $data
  */
 public function testGetInstalledExtraDataArray(array $data)
 {
     $mp = ExtensionDataHelper::getInstalledExtraData($data, 'migrationPath', true);
     $this->assertNotEmpty($mp);
 }
 /**
  * Prepares migration command
  *
  * @param array $ext
  * @param ReportingChain $chain
  * @param string $way
  * @param $group
  */
 public static function prepareMigrationTask(array $ext, ReportingChain $chain, $way = ExtensionsManager::MIGRATE_TYPE_UP, $group)
 {
     if ($ext['composer_type'] == Extension::TYPE_DOTPLANT) {
         $extData = ComposerInstalledSet::get()->getInstalled($ext['composer_name']);
         $packageMigrations = ExtensionDataHelper::getInstalledExtraData($extData, 'migrationPath', true);
         $packagePath = '@vendor' . '/' . $ext['composer_name'] . '/';
         foreach ($packageMigrations as $migrationPath) {
             $migrateTask = self::buildTask([realpath(Yii::getAlias('@app') . '/yii'), 'migrate/' . $way, '--migrationPath=' . $packagePath . $migrationPath, '--color=0', '--interactive=0', '--disableLookup=true', ExtensionsManager::MIGRATE_TYPE_DOWN == $way ? 68888 : ''], $group);
             $chain->addTask($migrateTask);
         }
     }
 }