使用1个对象来表示2个模型

We are building a core shopping cart that our company will use as a foundation for multiple shopping carts we will build. These are highly specialized, so different product types will require their own tables of data.

For instance, for a cart that sells labels...

product - id | type_id | created

label - id | product_id | x | y | z

We're struggling with how to structure our objects. We'd like to programmatically only interact with the Label class and have the data be "split" so to speak between the two tables. One idea we tossed around was creating a view to use for querying and then just overwriting the object's save() method to actually interact with each table's setters/save functionality.

Has anyone accomplished this or at least faced a similar challenge?

Update: Of course this begs the question... is there a scenario where both tables might have the same column name? And if so, how to handle it.

You can use name/value pair for specialized columns. With "name" part consistent with column names, you can have generalized setter/getter.

Product is related table, so you can interact with it via relation, for instance $labelModel->product. So you have model for each table, as yii suggest. And you can interact only with Label model if you place your functionality at beforeSave(), afterSave() and other methods.