yii\console\Application::init PHP Method

init() public method

Initialize the application.
public init ( )
    public function init()
    {
        parent::init();
        if ($this->enableCoreCommands) {
            foreach ($this->coreCommands() as $id => $command) {
                if (!isset($this->controllerMap[$id])) {
                    $this->controllerMap[$id] = $command;
                }
            }
        }
        // ensure we have the 'help' command so that we can list the available commands
        if (!isset($this->controllerMap['help'])) {
            $this->controllerMap['help'] = 'yii\\console\\controllers\\HelpController';
        }
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->_modulesConfigDependency = new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()']);
     DbState::bootstrap();
     Yii::$container->set('gromver\\modulequery\\ModuleQuery', ['cache' => $this->cache, 'cacheDependency' => new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()'])]);
 }
All Usage Examples Of yii\console\Application::init