Well, maybe it's still better to have the database ensuring the
uniqueness of the user_id... But I'd rather have CakePHP control this.
So why doesn't CakePHP automatically run a uniqueness validation for a
$belongsTo foreign key field? I think this would really make sense...

On Tue, Dec 7, 2010 at 4:53 PM, Joshua Muheim <psybea...@gmail.com> wrote:
> OK, thought a bit more about this topic. What about when a User has
> two UserProfile records in the database table pointing at him? In this
> case, CakePHP simply seems to take the first one and ignores the
> second.
>
> But somehow this seems unclean to me: why is the foreign key stored in
> the UserProfile's table, and not in the User's table?
>
> Instead of Users.user_profile_id, we could use UserProfiles.user_id?
> This way there could really only one UserProfile record belong a User
> record...?
>
> On Tue, Dec 7, 2010 at 2:38 PM, Joshua Muheim <psybea...@gmail.com> wrote:
>> Thanks, guys. :-)
>>
>> On Tue, Dec 7, 2010 at 2:03 PM, euromark <dereurom...@googlemail.com> wrote:
>>> i did it the same way
>>> I just named it "UserInfos" :)
>>>
>>> but the relation can be 0 or 1 - so thats absolutely fine
>>>
>>> On 7 Dez., 12:09, Bogdan Bursuc <bogdanbursu...@gmail.com> wrote:
>>>> No it's fine.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Dec 7, 2010 at 1:00 PM, psybear83 <psybea...@gmail.com> wrote:
>>>> > 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 sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com For more options, visit this group 
>>>> > athttp://groups.google.com/group/cake-php?hl=en
>>>>
>>>> --
>>>> Thanks,
>>>> Bogdan Iulian Bursuc
>>>
>>> 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+unsubscr...@googlegroups.com For more options, visit this group at 
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to