Nested Modules

Hello everyone,

I recently found out about Yii, still in the process of reading tutorials and running the installations again and again.

I need some help of experienced users, I will try to explain my problems with modules / models.

First let me explain what I am trying to achieve.

I want to end up having my application with, for example, a module access, inside this module there must be modules users and articles, inside users module there must be models personalInfo and accountInfo, inside articles module there must be models artEntries and artCategories.

So links to the models would be for example: http ://yiiapp/?r=access/users/personalInfo

Later on I want to give privileges to my users based on the modules/models structure, for example i want a user to have administrator rights in all the models inside articles module or in all modules inside access module.

Now let me explain what exactly I am doing to create this structure.




1.> module access

2.> module access/modules/users



After that I edit my main.php configuration.




'modules' => array

         (

	  'access' => array

                (

		 'modules'=>array

                        (

			 'users',

			 'articles',

			),

		),

	),



I enter the yiic again and do the following:




1.> model access.modules.users.models.personalInfo tbl_personalInfo

2.> crud access.modules.users.models.personalInfo



Nothing shows errors, but when I look at the files structure that was created by these commands here is what I see:

  1. The views and the controllers files are created not under the users module, but under the access module.

  2. The file AccessModule.php is created in modules/access/, but the file UsersModule.php (that I think should be created under the modules/access/modules/users/) is not there.

  3. The url to personalInfo is now http ://yiiapp/?r=access/personalInfo

So I guess that the framework has put everything under access module under a big umbrella and is treating it all the same, but how can I separate it?

If anyone can help me with this, I’d really appreciate it. In case you have a good resource where I can read this up, would be great too.

The official tutorial has the following info about modules (quoting):

So I did as I was told, I referred… did not help.

Please help :)

I agree with you that Yii should create views and controllers under the submodule structure, but for now, I just copy and paste all generated views and controllers to my submodule’s dir and it works fine

:)

regards!

http://www.yiiframework.com/forum/index.php?/topic/13267-gii-nested-modules/