How could I list all products in the example? The implementation of product as CModel is OK or?
The data is saved in 1 table per class, but the tables of the extended ones just contain their own attributes.
I am not sure how to use in Yii a database without ActiveRecord, all the examples are with it, there are no examples concerning practical use of DAO.
And where to build the criterias, it is often done in the controller, why not in the model?
Example:
abstract class product extends CModel
{
public id;
public price;
}
class car extends product
{
public hp;
}
class computer extends product
{
public ram;
}
Why do you want to use DAO instead of CActiveRecord?
It is better to use composition in your case, at least if you ask me. But somehow I feel you should delve into Yii by doing the blog tutorial and so on, because that is an advanced technique.
However it confuses me a bit, that I should have just 1 class, because inheritance is in OOP always mentioned, but in this case it would probably just cause problems like the one above or has someone an idea how to manage it with inheritance?
No, I think it doesn’t help me, because I have pretty many attributes, but they in general they are not dynamic, means the overall list of attributes will always be nearly the same.
Any other idea how to handle it, maybe I need any class, that manages all the objects?
i never say that suit you ; it just related (about product table design ) , you can also search form stackoverflow with product table schema ; and i think this one is not bad Database Design Strategy : Product Table on E-Commerce System (EAV, Class Table Inheritance or Concrete Table Inheritance)
and as bennouna point , you should read this wiki singleTableInheritance in Yii