Skip to content

Commit

Permalink
Merge pull request #5 from Alegzander/fix-bootstrap
Browse files Browse the repository at this point in the history
removed getModuleNested method, because its broken
  • Loading branch information
Yan committed Jun 3, 2016
2 parents 6854022 + 45b14dc commit 9978b43
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ class Bootstrap implements \yii\base\BootstrapInterface
*/
public function bootstrap($app)
{
/** @var $module Module */
$module = $this->getModuleNested('oauth2', $app);

if ($module instanceof Module) {
/** @var $module Module */
if ($app->hasModule('oauth2') && $module = $app->getModule('oauth2') instanceof Module) {
$this->_modelMap = array_merge($this->_modelMap, $module->modelMap);
foreach ($this->_modelMap as $name => $definition) {
\Yii::$container->set("filsh\\yii2\\oauth2server\\models\\" . $name, $definition);
Expand All @@ -65,23 +63,4 @@ public function bootstrap($app)
}
}
}

public function getModuleNested($needle, $app)
{
/** @var $module Module */
if (($module = $app->getModule($needle)) !== null)
return $module;

foreach ($app->getModules() as $id => $module) {
$server = $app->getModule($id)->getModule($needle);
if ($server != null) {
return $server;
} else {
$this->getModuleNested($module->getModules());
}
}

return false;
}

}

0 comments on commit 9978b43

Please sign in to comment.