how to get the id of one table, when using a single form for 2 models

Hi guys,

and again I’m stuck…

I’m using a single form, collecting data for 2 models with a ONE_MANY connection.

Table 1 is called ‘entry’ wich has many ‘translations’. My problem is now, that everything works fine, but i have to set the entry_id in the ‘translation’ table. The entry_id is set by the MySQL database … what’s the safest method to do this? … without having problems later on if for example more creates happen to the same time? (I think it might be a problem to search for the highest id in the entry table or something similar …)

Tanks a lot in advance,


In your controller you can get the Id of the parent table (actionUpdate()) and then save the child using that id. In the actionCreate() you need to first save the parent, retrieve the PK (


), and then save the child using the parent Id.

Super! Thanks a lot mate. This solved my problem! (I thought i’d have to make an extra select statement during create, what pissed me off a little bit :-P)