0

I have the following associations

User hasOne Person

Person hasOne Contacts, Address, Student, and Employee

using saveAssociate I can create User and Person at the same time, however what I want is that I can also create Contacts, Address and either Student or Employee (determined by User.user_type) simultaneously.

can I do that with one call to saveAssociate? Or is there some other way?

1 Answer 1

0

can I do that with one call to saveAssociate?

Yes - you can.

(It's shown quite clearly in the CakePHP book in the section about "Saving your data".)

3
  • Well I know I can create the 4 associated models with one call of saveAssociated... but what if I just want to make 3 of the 4?
    – Basilio
    Feb 28, 2014 at 23:57
  • Then only pass 3 of the 4 in the array when you save.
    – Dave
    Mar 1, 2014 at 2:52
  • I just realized about the whole data array a bit later. Thanks.
    – Basilio
    Mar 1, 2014 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.