associations - Where should I add data for an associated model in cakephp-3 -
i create few default entities users when register account, example being profile, there no data user registration form, user entities should have profile still seems fitting create it.
before 'but there no data, cope in controller/views' - yes know, not use cases allow it, , require empty/default data.
is should added data register form in controller, before doing save? me seems more logical there should in model says valid user has profile, , if there no data there create (perhaps using username profile full name).
is achievable in beforesave callback or controller?
is there minimum need have in patchentity related entity save (my current attempts have profile in debug, none of data thought setting, nothing saves)
many thanks
i hope got questions right.
yes why shouldn't possible? create associated(http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-with-associations) entry , make fields nullable.
to save related should follow convention user(id,name,pw,...) profile(id,user_id,...) make sure user has 1 profile make user_id unique.
Comments
Post a Comment