for some security reasons I try to save 2 custom objects (different models) into the database, via:
try {
$transaction = Mage::getResourceModel('core/transaction')
->addObject($object1)
->addObject($object2);
$transaction->save();
} catch (Exception $e) {
echo $e->getMessage();
}
The problem is, that the database table of $object2 contains a reference id to $object1, but this is auto incremented in $object1 and unknown at this point.
To visualize my problem:
database table of $object1:
entity_id | ... | ...
-----------------------------
1234 | ... | ...
the database table of $object2 should looks like this:
entity_id | object_1_id | ...
---------------------------------
5678 | 1234 | ...
How can I get the auto incremented id of $object1 and save within the same transaction to $object2 table? Is it possible? Makes that sense?
Thanks for help.