I am developing Symfony-Doctrine based application. I used Concrete Table Inheritance strategy.But now I faced with some problems. I have following tables:
Product : has some properites
Computer : Extends product.
Notebook : extends Computer.
Ipad : extends Computer.
....an so on.. many tables with different categories.I have following questions.Can anyone help or give a source please?
In my main page I have search box which does search according to product name. For which table I have to write search query?
Second question. Again in my main page I have viewed some products from different table.Then user clicks one of these product. How I will decide which table ID its?
Concrete inheritance gives you maybe the cleanest schema, but it does not allow you to query on several tables. So with concrete inheritance, you must write your query for each child model class, and merge the results. If I were you, I would read this page about the search in symfony, and write a lucene query to achieve this multi-class search. It will be faster, and might be easier.
The route for your product shoud look like this : /product/:product_category/:product_subcategory/id You can't find your product with an ID which may not be unique across tables.