From ef0a3847081bc65a98662683d0ac7fc5aa0f84cc Mon Sep 17 00:00:00 2001 From: Eugine Terentev Date: Wed, 15 Oct 2014 13:51:51 +0300 Subject: [PATCH] implementing mongodb panel bootstrap behavior #3855 --- extensions/mongodb/composer.json | 3 ++- extensions/mongodb/debug/MongoDbPanel.php | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/extensions/mongodb/composer.json b/extensions/mongodb/composer.json index 142567c355..efc265b40a 100644 --- a/extensions/mongodb/composer.json +++ b/extensions/mongodb/composer.json @@ -27,6 +27,7 @@ "extra": { "branch-alias": { "dev-master": "2.0.x-dev" - } + }, + "bootstrap": "yii\\mongodb\\debug\\MongoDbPanel" } } diff --git a/extensions/mongodb/debug/MongoDbPanel.php b/extensions/mongodb/debug/MongoDbPanel.php index e8b5e2e4c8..92a18fc714 100644 --- a/extensions/mongodb/debug/MongoDbPanel.php +++ b/extensions/mongodb/debug/MongoDbPanel.php @@ -7,6 +7,8 @@ namespace yii\mongodb\debug; +use yii\base\Application; +use yii\base\BootstrapInterface; use yii\debug\panels\DbPanel; use yii\log\Logger; @@ -16,8 +18,21 @@ use yii\log\Logger; * @author Klimov Paul * @since 2.0.1 */ -class MongoDbPanel extends DbPanel +class MongoDbPanel extends DbPanel implements BootstrapInterface { + /** + * Bootstrap method to be called during application bootstrap stage. + * @param Application $app the application currently running + */ + public function bootstrap($app) + { + $modules = $app->getModules(); + if(isset($modules['debug'])){ + $modules['debug']['panels']['mongodb'] = ['class'=>self::className()]; + } + $app->setModules($modules); + } + /** * @inheritdoc */ @@ -48,4 +63,5 @@ class MongoDbPanel extends DbPanel 'yii\mongodb\Database::*', ]); } -} \ No newline at end of file + +} \ No newline at end of file