YIIC Shell

Using 1.1 SVN from a couple of days ago.

If I use the command line to create a module, then create a model attached to that module, the model file is written to the wrong directory. eg.




>> module admin

      mkdir C:/wamp/www/yii/protected/modules

      mkdir C:/wamp/www/yii/protected/modules/admin

      mkdir C:/wamp/www/yii/protected/modules/admin/components

      mkdir C:/wamp/www/yii/protected/modules/admin/controllers

   generate controllers/DefaultController.php

      mkdir C:/wamp/www/yii/protected/modules/admin/models

      mkdir C:/wamp/www/yii/protected/modules/admin/views

      mkdir C:/wamp/www/yii/protected/modules/admin/views/default

   generate views/default/index.php

      mkdir C:/wamp/www/yii/protected/modules/admin/views/layouts

   generate AdminModule.php


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

    C:\wamp\www\yii\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.


>> exit



All good. Adjusted config file as per above:




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


// also:


	'import'=>array(

		'application.models.*',

		'application.components.*',

		'application.modules.admin.*', 

	),



Now create the model:




>> model admin.Addresses

   generate models/Addresses.php

   generate fixtures/Addresses.php

   generate unit/AddressesTest.php


The following model classes are successfully generated:

    Addresses


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

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

    print_r($model);



I am finding the model file in:

c:\wamp\www\yii\protected\modules\admin\Addresses.php

rather than:

c:\wamp\www\yii\protected\modules\admin\models\Addresses.php

If I move the file to its correct location, the application runs just fine and I can access my new addresses pages.

You should use model admin.models.Addresses.

Well, I will try that, however to me that is curious, since if I wish to create a model in the regular path I only need use: model Mymodel and not model models.Mymodel