0

Yesterday i post a question i found it was not well described. After long research i found the term "Polymorphic Associations".

I try to find as simple solution as possible: MySQL - Conditional Foreign Key Constraints

But in my case the serial number is very important.The guide says in the link : product_id(in my case) will handle this. The problem is the product number is not exactly identify which ProductA or which ProductB was.

enter image description here

There is still problem that the implementation will be used in Cakephp which does not support composite primary keys.. Any advice?

Community
  • 1
  • 1
Andrewboy
  • 364
  • 5
  • 15

1 Answers1

0

CakePHP 3.0 supports composite PK's very well.

Also this would still work with CakePHP 2.x. product_list_items is just a join table with some constraints. Check the manual how to save HABTM associations. Your diagram will work without issues in CakePHP and you can save and read additional data from the join table.

floriank
  • 25,546
  • 9
  • 42
  • 66