Tuesday, December 7, 2010

Is it okay to have a hasOne relation, where some records DON'T have one? --psybear

Hey everybody

I have just split up my User model into a User and a UserProfile
model, because I wanted to prevent my User model from having too much
fields (address data, profile data etc.). So now my User hasOne
UserProfile.

But there are some users that DON'T have a UserProfile - these are
mainly system users (like "guest") that don't actually represent a
real person.

My question is: is this OK? Because when using $scaffold, the hasOne
relationships is displayed in any case whether there is a UserProfile
or not, i.e. when there's no UserProfile, the hasOne table is just
displayed without data. So I'm just wondering whether there's a need
that every hasOne relationship actually DOES HAVE a related record? Or
can I just forget about this "issue"? :-)

Thanks for information
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate