-3
我有3個表格。Symfony2學說關係
Product
+-----+-----------+
| id | name |
+-----+-----------+
| 1 | Product 1 |
+-----+-----------+
| 2 | Product 2 |
+-----+-----------+
Categories
+-----+-----------+
| id | name |
+-----+-----------+
| 1 | cat 1 |
+-----+-----------+
| 2 | cat 2 |
+-----+-----------+
ProductCategories
+-----+------+------+
| id | p_id | c_id |
+-----+------+------+
| 1 | 1 | 1 |
+-----+------+------+
| 2 | 1 | 2 |
+-----+------+------+
| 3 | 2 | 1 |
+-----+------+------+
問:
- 我需要建立一個3實體?產品,類別和產品分類
- 如何按類別進行產品編號,它們應包含有關其分配的類別的信息?
- 創建新產品並從列表中記錄的List,category_id和product_id中指定一個類別:product_categories?
也許你需要先閱讀這個http://symfony.com/doc/current/doctrine.html – yceruto