Right, having looked at this, do you mean that the auto incremented ID is created, then passed into the session variable, then the session variable inserts it into the relationship table (foreign key table)?
So, on that basis, I assume that any code creating the ID's needs to be placed before the insert behaviours code so the session variable insert has something to collect and therefore insert.
For example, I would have a product sector table ID and a manufacturer table ID, and it is those two ID's I insert into the relationship table.
Do I understand this correctly?
I don't need to set up foreign keys within the MySQL database do I? I can use SQL queries to create the relationships can't I?