yii\debug\Module::bootstrap PHP Метод

bootstrap() публичный Метод

public bootstrap ( $app )
    public function bootstrap($app)
    {
        $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
        // delay attaching event handler to the view component after it is fully configured
        $app->on(Application::EVENT_BEFORE_REQUEST, function () use($app) {
            $app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
            $app->getResponse()->on(Response::EVENT_AFTER_PREPARE, [$this, 'setDebugHeaders']);
        });
        $app->getUrlManager()->addRules([['class' => 'yii\\web\\UrlRule', 'route' => $this->id, 'pattern' => $this->id], ['class' => 'yii\\web\\UrlRule', 'route' => $this->id . '/<controller>/<action>', 'pattern' => $this->id . '/<controller:[\\w\\-]+>/<action:[\\w\\-]+>']], false);
    }

Usage Example

Пример #1
0
 /**
  * @inheritdoc
  */
 public function bootstrap($app)
 {
     parent::bootstrap($app);
     // override the log target with ours
     $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
 }