BTM relation with the same model


I need to connect components with links by relationship Many to Many.
Therefore I have a components table and a pivot table named components_components.
This pivot table has got field :

  • id
  • component_from_id
  • component_to_id
  • comment

A component is linked to another one. Many kind of links can exist between two components.
Component From ====> Component To

I understand that I need to have a specific joinModel because conventions are not ok, but i don’t understand well how to set parameter for relationships in both tables.

Can you help me to find out the good way to use cakephp in this case ?

Thanks a lot

This has been asked and answered loads of times. Does one of these help you?

Thanks for you reply but I’m looking for Many To Many relationship. This involves a pivot Table.
This case is specific because it concernes only one table.
Many links can exist between components. => I designed that like below

Any idea ?