Structure for Categories, subcategories and Products

172 views Asked by At

I have a table "Category" and another "Subcategory". Then I have "Products" table.

Some of these products will be related directly to the "Subcategroy" table, but some of them will be related directly to "Category". What should be the tables structure in this case?

1

There are 1 answers

1
Ivan On

Use Association Mapping

This chapter explains mapping associations between objects.

Instead of working with foreign keys in your code, you will always work with references to objects instead and Doctrine will convert those references to foreign keys internally.

http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html