how to generate crud in modules folder in yii
I am try create CRUD开发者_运维百科 Through GII in YII Framework in modules folder .But there one option to change the CRUD path.
I looked around for this too. Hope this will help.
- Create a module via Module Generator.
- Register your module name in the config main.php (modules array)
- Create a model via Model Generator. Fill in the fields and put this in Model Path : application.modules.[module-name].models
- Create crud via Crud Generator. Fill in the fields and put this in Model Class: [module-name].models.[model-name]
Sorry the reference is in Indonesian. Source
- Create a module via Module Generator.
- Register your module name in the config main.php (modules array)
- Create a model via Model Generator. Fill in the fields and put this in Model Path : application.modules.[module-name].models
- Create crud via Crud Generator. Fill in the fields and put this in Model Class: [module-name].models.[model-name] add module name in Controller ID :[module-name]/[Controller-name]
module-name/user
generatesmodule-name/UserController.php
. If the application has anmodule-name
module enabled, it will generateUserController
(and other CRUD code) within the modulemodule-name
instead.
Maybe is useful to create controllers
like that you can get it your controller and view inside the module you want. Regarding the models, I am agree with previous answers.
Byee
Model Class: user_access.models.User
Controller ID: user_access/user
Model Class : application.modules.guestbook.models.Guestbook
Controller ID : guestbook/Default
Note : guestbook is my module name and i created crud directly inside guestbook folder using above path.
精彩评论