Update tables at the same time

Can anyone please help me for below data. How to update my data among tables at the same time.

Array
(
[username] => E53@gmail.com
[email] => E53@gmail.com
[password] =>
[role_id] => 3
[subscriber_id] => 27
[employee] => Array
(
[name] => E53
[name_bengali] => E53
[email] => E53@gmail.com
[designation_id] => 1
[department_id] => 1
[contact_number] => 121
[date_of_birth] =>
[date_of_joining] =>
[code] => E-000053
[image] => Array
(
[tmp_name] => C:\xampp\tmp\phpC308.tmp
[error] => 0
[name] => E-000053.jpg
[type] => image/jpeg
[size] => 6709
)

        [unit_id] => 20
        [is_del] => 
        [is_active] => 1
    )

)

You haven’t shown the association definitions from your models, or the code you’re using to patch your entity. Or specified whether no additional records are being created, or just not everything you want.

basically you need to do these:

  • prepare your data in nested array to reflex your models associations properly.
  • patchEntity from your top level model, any error occur in any level of model will result top level hasError
  • save the top level entity , it will save all of associated model as well, in 1 save() call.
  • If the save() get error for any associated model, the saved model on higher level will be rollback, any nothing is saved. (I am not 100% sure of this, but … just try yourself)