Yii2-Gii Generate Common

Hi, I need to make CRUD with Gii and things are a bit confusing. I want to generate models in common (advanced template) and I do not know how to do that! Which configuration do I use? here is my main-local.php in in common What else do I need to do? Trying to get it on browser it fails


return [

	'components' => [

    	'db' => [

        	'class' => 'yii\db\Connection',

        	'dsn' => 'mysql:host=localhost;dbname=nipate',

        	'username' => 'root',

        	'password' => 'jesus',

        	'charset' => 'utf8',


    	'mail' => [

        	'class' => 'yii\swiftmailer\Mailer',

        	'viewPath' => '@common/mail',

        	'useFileTransport' => true,



	'modules' => [

    	'gii' => 'yii\gii\Module', 



In your Gii model generation page, click on the namespace field and change it to common\models.

Forgot to add… it does not matter how you access gii. You can access it by localhost/frontend/web/gii or from backend.

If you access it from frontend you may see the namespace frontend\models defaulting. Just change this to common\models or wherever you want.

Thanks alot.

I was not able to reach Gii and All I needed to do was adding?r=gii instead of /gii

So URL goes like http://localhost/app/frontend/web/?r=gii not http://localhost/app/frontend/web/gii

Yes that’s correct if you are using the default GET methods and not set prettyUrl to true for urlManager in your config.

If you have set prettyUrl to true, showScriptName to false (and made the index.php changes in htaccess) - then you could access by http://localhost/app/frontend/web/gii.

Gotcha :)