admin as module, have some questions about this setup

I’m implementing backend for my application and after reading this thread:

I decided to create admin area as new module as yiqing95 has suggested. I’m wondering about Models and Crud functionallity. Do I use gii to create models and crud functionallity for admin and ending up with duplicate model/controllers/views files or do I somehow use already existing models/controllers/view files? First time I’m doing this so I’m unsure if I should have duplicate of every model, controller and view files in admin module or if I should reuse already existing models and crud functionallity in admin module then how do I do that, need few examples if possible?

well I figured it out. Here is what you have to do. Copy the Controllers and view files, you keep the models where they are unless you need specific models for admin module. Simple as that! :))

in the old discussion page ,you see some one advice we should develop the backend as a standard app .but when you access front-end from backend the url is a problem ,because they are use different entry script(index.php and the admin.php(whatever the name is )) see the post How to create URLs to other applications.

in both situations we all want share some basic classes( such as models ,helper functions and so no…),most of times we only need the “admin” views for backend manager missions (may be you also need create / update),these can be generated by gii .you can copy if from another modules or use gii again to generate a duplicate views(admin create update, when generate the “crud” you can use pathAlias to reffer to other modules 's components like : album.models.someAr),but the models you should share with other modules (single control point is necessary ,bussiness logic shouldn’t scatter everywhere ) ,for accessing

the components from other modules , use Yii::import or config imports in main.php or import it in you admin module (see the rights extension and the gii):

// Set required classes for import.







                             //another models from different modules 





         $this->controllerMap = array(





		// Set the required components.








                'class' => 'common.components.KMcaGenerator'



you see we can use "import" to share the models from another modules(helper ,util classes are the same), we can replace the global components use module::setComponents method ,normally you may use a different "XWebUser" from the front-end one .

in another view , if you choose standalone app as your backend ,what you should do :lol: , we all don’t want repeat ourselves .