<?php

namespace haqqi\storm;


use yii\base\Application;
use yii\base\BootstrapInterface;
use yii\base\Event;
use yii\console\Controller;
use yii\web\View;

class Bootstrap implements BootstrapInterface {

  public function bootstrap($app) {

    $app->on(Application::EVENT_BEFORE_REQUEST, function ($event) {
      /**
       * @var $event Event
       */

      /*
       * Setup the config of asset bundles
       */
      if(!$event->action->controller instanceof Controller) {
        $bundles =& $event->sender->assetManager->bundles;

        $bundles['yii\web\JqueryAsset']['js']        = ['jquery.min.js'];
        $bundles['yii\web\JqueryAsset']['jsOptions'] = ['position' => View::POS_HEAD];

        $bundles['yii\bootstrap\BootstrapAsset']['css'] = ['css/bootstrap.min.css'];

        $bundles['yii\bootstrap\BootstrapPluginAsset']['js']        = ['js/bootstrap.min.js'];
        $bundles['yii\bootstrap\BootstrapPluginAsset']['jsOptions'] = ['position' => View::POS_HEAD];

        $bundles['mimicreative\assets\MetisMenuAsset']['css'] = [];

//        \FB::log($event->sender->assetManager->bundles);
      }
    });
  }

}
<?php

namespace haqqi\storm;


use yii\base\Application;
use yii\base\BootstrapInterface;
use yii\base\Event;
use yii\console\Controller;
use yii\web\View;

class Bootstrap implements BootstrapInterface {

  public function bootstrap($app) {

    $app->on(Application::EVENT_BEFORE_REQUEST, function ($event) {
      /**
       * @var $event Event
       */

    \Yii::$container->set('yii\web\JqueryAsset', [
      'js' => ['jquery.min.js'],
      'jsOptions' => ['position' => View::POS_HEAD]
    ]);

    \Yii::$container->set('yii\bootstrap\BootstrapAsset', [
      'css' => ['css/bootstrap.min.css']
    ]);

    \Yii::$container->set('yii\bootstrap\BootstrapPluginAsset', [
      'js' => ['js/bootstrap.min.js'],
      'jsOptions' => ['position' => View::POS_HEAD]
    ]);

    \Yii::$container->set('mimicreative\assets\MetisMenuAsset', [
      'css' => []
    ]);

    });
  }

}
Fix DI container when using console controller
Fix DI container when using console controller
