Closed szimek closed 10 years ago
Honestly, I'd do whatever suits you best but if it was me and you are probably going to access the object via the user then I'd probably just store it as a profile property, yes. Your user.getProfile()
would populate this property for you.
Also keep in mind I don't know how important it is to keep a 1 to 1 match of your bqxkend structure. If you find that just having a user object and api is all you need and you just have a property that is big it might not be worth it to manage spinning up profile objects. You probably don't need the verbosity in your frontend of user.profile.save() when you could simply have user.save() distribute the profile data on the backend.
Yeah, you're probably right. Thanks!
How do you handle model associations like one-to-one (e.g. user has one profile) and one-to-many (e.g. user has many posts)?
Do you manually overwrite properties with instances of proper class, e.g. like this:
do you have a smarter way of doing it or you don't do anything like this at all?