Browse Source

GII sub-modules support - see #871

tags/2.0.0-beta
Luciano Baraglia 11 years ago
parent
commit
c2457f95e9
  1. 2
      framework/yii/gii/generators/controller/Generator.php
  2. 7
      framework/yii/gii/generators/module/Generator.php

2
framework/yii/gii/generators/controller/Generator.php

@ -197,7 +197,7 @@ class Generator extends \yii\gii\Generator
*/ */
public function getModule() public function getModule()
{ {
if (($pos = strpos($this->controller, '/')) !== false) { if (($pos = strrpos($this->controller, '/')) !== false) {
$id = substr($this->controller, 0, $pos); $id = substr($this->controller, 0, $pos);
if (($module = Yii::$app->getModule($id)) !== null) { if (($module = Yii::$app->getModule($id)) !== null) {
return $module; return $module;

7
framework/yii/gii/generators/module/Generator.php

@ -87,18 +87,17 @@ class Generator extends \yii\gii\Generator
$output = <<<EOD $output = <<<EOD
<p>The module has been generated successfully.</p> <p>The module has been generated successfully.</p>
<p>To access the module, you need to modify the application configuration as follows:</p> <p>To access the module, you need to add this to your application configuration:</p>
EOD; EOD;
$code = <<<EOD $code = <<<EOD
<?php <?php
return array( ......
'modules'=>array( 'modules' => array(
'{$this->moduleID}' => array( '{$this->moduleID}' => array(
'class' => '{$this->moduleClass}', 'class' => '{$this->moduleClass}',
), ),
), ),
...... ......
);
EOD; EOD;
return $output . '<pre>' . highlight_string($code, true) . '</pre>'; return $output . '<pre>' . highlight_string($code, true) . '</pre>';

Loading…
Cancel
Save