To multi table or not...


I am currently working on my first major Yii application and would like some input from more experienced developers.

The application is going to be a classified type application and I want to make the ads somewhat specific.

Eg. Autos will have colour, fuel type, km’s, year etc.

Houses will have # bedrooms, bathrooms etc.

However they will all share similar aspects(Title, Description, Created Date, Created User, Update Date, Update User, Price etc.)

My design is

Item Table(General Database Table with all the same aspects.)

Auto Table(Attributes specific to autos which will be child of item table)

Real Estate Table(…)


Would this be the way you would design the system? Why or why not?

Is there a Yii standard of implementing the system? Eg loading various views depending on the AR Model type?

Any and all feedback would be greatly appreciated.

My experience so far with Yii is going through the Agile Development with Yii 1.1 and PHP5 book completely, I can honestly say I love this framework.

In my opinion, you will have it much easier if you separate your models. At first, it can seem like they share a lot of properties, but what if one model digresses at one point? As for the access, if you have one table per model, you can keep your transactions close together. If you have two tables, you always have to join them on select, and when you create, update and delete them, you have to do it in multiple tables. Better separate.

Thanks for the Input, it was last last night and my mind was going a mile a minute.

After thinking about everything I did decide to revert back to separate models.