Generating Active Record Option From Existing Database?


(Basire) #1

Let say I have a database of 100 tables and I want to create active record classes for everyone of them, is there a way to do this?


(Waprave) #2

(Basire) #3

Where is that quote from because out of context I have no idea what that means.


(tri - Tommy Riboe) #4

From your app directory type the command:

protected/yiic shell

You will see the following

Type "help model"

/Tommy


(Basire) #5

Thanks, that makes a lot more sense.

One other question. I generally name my tables plural (since they hold multiple records) and name my objects singular (since they only hold 1 record). Is they a way to use some sort of configuration file (XML or whatever) where I can say tablename=blog_posts and classname=blog_post or do I just have to build each model one at a time using the model <class-name> [table-name] syntax?

Also, are there any database naming conventions that yii assumes? I generally have everything (including table name and field name) lowercase with underscores.