Structure models for different types of products |
Hi,
in my app i have 3 types of products (smartwatches, smartphone and tablets). I don't know how to structure my models. All types have some properties in common (like a name, weight...) Then smarthphones and tablets both have some properties. What is a good way to structure the models? I would create a product-model and every other type can inherit from that. But what to do with smartphones and tablets? Where i have to store the common properties? PHP Code: Product_model extends CI_Model {} Another question: How can i get all the data from 2 database tables for an smartphone? The smartphone data are in one table (only for smartphones) and the other common data (name and so on) are in another table. In the product model there is a method find_all(), but there i get only the data from the products table. The second table for the join would be smartphone or smartwatch, but how can i get the name dynamic? |
Messages In This Thread |
Structure models for different types of products - by groovebird - 08-25-2015, 12:20 PM
RE: Structure models for different types of products - by mwhitney - 08-25-2015, 01:20 PM
RE: Structure models for different types of products - by groovebird - 08-25-2015, 02:42 PM
RE: Structure models for different types of products - by mwhitney - 08-26-2015, 06:31 AM
|