Yii Create Module using CRUD step by Step

Firstly create a module using Gii
screenshot_76I think this might be helpful how to create CRUD for modules in Yii.How to use Yii framework in modules

Create a table in database
"CREATE TABLE oow(id INTEGER PRIMARY KEY NOT NULL, serial_number TEXT, model_number TEXT, mdel_range TEXT, notes TEXT, created DATETIME ,modified DATETIME, createdby INTEGER, modifiedy INTEGER )"

Next Create Model for your table in moudule you just created. Make sure to change the model path to application.modules.YOURMODULENAME.models and click on Generate
screenshot_78

Last thing is to create the CRUD
Make sure you give model class name as
application.modules.YOURMODULENAME.models.MODELCLASSNAMEYOUJUSTCREATED
else it will give error as model not found while creating CRUD

screenshot_79

You can now run your moudule as
http://localhost/chs/chs/index.php?r=oow/search

If you are using SEO friendly URLs you probably need to change code as per your main.php in config folder

I hope this will help you

Thanks

Advertisements

4 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s