There's a MUCH simpler way - leave out the id column in  
sf_guard_user_profile, and use a user_id column (foreign key to  
sf_guard_user).

Works for me :)

I end up doing most of my stuff by working with user profiles, because  
that contains the data I need most often - firstname, lastname etc.  
Rarely do I actually need to modfiy the data in sf_guard_user table...  
so it doesn't make sense to be working with user objects directly.

I'm not sure if that's the *correct* way of doing it, but it's  
efficient, and it works for me :)

On 19 May 2008, at 16:08, kayoone wrote:

>
> mmh...the thing is, i dont want to have the sfGuard schema in my main
> schema because of the problems described above, and
> the relation betweet sfguarduser and the profile table is just set via
> the config, there is no real relationship i guess.
> The getProfile() method of the sfGuardPlugin is looking for the
> profile table name in the config and fetching the profile via
> the foreign key field which is also defined in the config so there is
> no way for me to change that behavior without changing the plugin
> code.
>
> However i can just use the user_id Foreign key field to make
> relationships to site content since thats also a primary key and we
> have only one profile
> per user, but that wont solve the problem that i have to do extra
> joins to get the username, also $article->getSfGuardUser() wont work
> then either i think.
>
> I really wonder how other people do this.
>
>
>
> On 19 Mai, 16:30, Lee Bolding <[EMAIL PROTECTED]> wrote:
>> Yes, but with a 1:1 relationship they'll both be the same number.  
>> They
>> should never be different unless you've manually altered your  
>> database.
>>
>> But you can use constraints to further enforce this :)
>>
>> On 19 May 2008, at 13:31, kayoone wrote:
>>
>>
>>
>>> but propel objects need their own a primary key, otherwise they wont
>>> work.
>>> But i will try if that works, still the profile_id will be different
>>> from the user_id
>>
>>> On 19 Mai, 12:21, Lee Bolding <[EMAIL PROTECTED]> wrote:
>>>> Make the user_profile->sfGuardUser a 1:1 relationship, then you  
>>>> don't
>>>> need to do a join - the profile ID will always be the same as the
>>>> user
>>>> id.
>>
>>>> Realistically, are users ever going to have more than 1 profile?
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to