Transaction support for foregin keys

Hello,

I'm trying to convert our customer order system from zend to phalcon.

Anyway it has multiple database design (orders customers adress shipment payment etc).

So some of tables uses other tables autoincrease id as as foregin key

And I want to use transactions on new system. However problem is when I try to save the order, model cannot found fk and throws exception.

let say a customer may had more than one address, so there where an customer address table. And each record needs a customer id. If customer was new customer I have to create new customer, then I have to save address in address table. However Model throws an exception for, given customer id does not found in customers table.

If I commit after the create new customer query it works and if any problem follwing steps (saving adress, order, payment etc) I cannot rollback.

How can I fix this. Or it was workaround ?

My best regards.