Modules, where to put models

I’m totally new to Yii and i have a quick question. I have created a Admin module for the back-end part of my website. I also have a Category model, but where do i put this? In the App section itself (protected/models) or in my admin module (protected/modules/admin/models)?

Because all of the category information needs to be manageble (CRUD-actions) by the admin module, but i also want, for example, to have a list with all the categories in the front-end part.


[color=#1C2837][size=2]it’s better to place your models in protected/models[/size][/color]

[size="2"][color="#1c2837"]there is many reason for that and actually there is no bottleneck if you place models in this manner.[/color][/size]



Ok, thanks, that’s clear for me.

But what about the controllers? Do i need to create two controllers (one for the front-end (so in protected/controllers) with only a actionIndex and another in the back-end (protected/modules/admin/controllers) with all the CRUD actions?

It all depends on need and structure of the site you are going to build.

usually you need to separate controller for module it’s one of the reason you are using modules to separate the code if you want to place controller in protect/controller why do you want to use modules?

Yes, that’s pretty logic indeed. And when you send the data to the view by the controller it will end up in de App’s view instead of the Admin modules’ view i guess? (when you use one controller for both the Admin module and the App itself)