[SOLVED] yiic shell module problem

I ran yiic shell

after that created module admin, after that want create model Users in module admin. It isn’t work for me.

My dump:


Yii Interactive Tool v1.1 (based on Yii v1.1.1)

Please type 'help' for help. Type 'exit' to quit.

>> module admin

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/messages

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/views

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/views/default

   generate views/default/index.php

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/views/layouts

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/components

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/controllers

   generate controllers/DefaultController.php

      mkdir /home/ilyatau/Work/projects/LookAway/protected/modules/admin/models

   generate AdminModule.php


Module 'admin' has been created under the following folder:

    /home/ilyatau/Work/projects/LookAway/protected/modules/admin


You may access it in the browser using the following URL:

    http://hostname/path/to/index.php?r=admin


Note, the module needs to be installed first by adding 'admin'

to the 'modules' property in the application configuration.


>> model admin.models.Users users

   generate models/Users.php


Warning: file_put_contents(/Users.php): failed to open stream: Permission denied in /home/ilyatau/Work/yii-last/framework/console/CConsoleCommand.php on line 154

  unchanged fixtures/users.php

  unchanged unit/UsersTest.php


Warning: include_once(/Users.php): failed to open stream: No such file or directory in /home/ilyatau/Work/yii-last/framework/cli/commands/shell/ModelCommand.php on line 366


Warning: include_once(): Failed opening '/Users.php' for inclusion (include_path='.:/home/ilyatau/Work/projects/LookAway/protected/modules/admin:/home/ilyatau/Work/projects/LookAway/protected/components:/home/ilyatau/Work/projects/LookAway/protected/models:/usr/share/php5:/usr/share/php') in /home/ilyatau/Work/yii-last/framework/cli/commands/shell/ModelCommand.php on line 366


The following model classes are successfully generated:

    Users


If you have a 'db' database connection, you can test these models now with:

    $model=Users::model()->find();

    print_r($model);


>> 



I received Warnings, and modules/admin/models is empty

Thank you.

Ilya

I find something. After creating admin module


>>module admin

I can’t use it.

I wrote in config/main.php


'modules'=>array('admin'),

but if I try url: http://localhost/LookAway/index.php?r=admin

It’s gave me

Any ideas?

Thank you

Ilya

I don’t know why but if I write


'modules'=>array('admin'),

after


'components'=>array(...

it does not work, if before it work

Why it’s happend?

Thank you

Ilya

Are you sure you aren’t putting it inside components array when you intend after?

During development environment you should put it like :-

'modules'=>array(


	// uncomment the following to enable the Gii tool


	


	'gii'=>array(


		'class'=>'system.gii.GiiModule',


		'password'=>'softin99',


	 	// If removed, Gii defaults to localhost only. Edit carefully to taste.


		'ipFilters'=>array('127.0.0.1','::1'),


	),


[b]'admin',[/b]


),

But in Production you should comment in "gii module" for security reasons and should put your module after component like this (be care full it should not present within component block) :-

'modules'=>array(


	[b]'admin',[/b]


),