I am building a site with symfony-1.4.8 and using
sfDoctrineGuardPlugin-5.0.0 to handle authentication.  To store
additional user info I created a user table.
user:
  columns:
    user_id:      { type: integer, notnull: true }
    address1:     { type: string(255), notnull: true }
    city:         { type: string(50), notnull: true }
    state_id:     { type: integer }
    zip:          { type: string(20), notnull: true }
    country_id:   { type: integer }
  relations:
    sfGuardUser:  { local: user_id, foreign: id }
    state:        { local: state_id, foreign: id }
    country:      { local: country_id, foreign: id }

I built a user_profile module based on the user table           php symfony
doctrine:generate-module --non-verbose-templates --with-show frontend
user_profile user

To display ALL data for the logged in user I added a new method to
userTable.class.php:
        public function getUserProfile()
                {
                $user_id = sfContext::getInstance()->getUser()->getGuardUser()-
>getId();
                $q = $this->createQuery('u')
                        ->leftJoin('u.sfGuardUser sfu')
                        ->leftJoin('u.state st')
                        ->leftJoin('u.country c')
                        ->WHERE('u.user_id = ?', $user_id);
                return $q->execute();
                }
Which I call from executeIndex of user_profile actions.class.php
$this->users = Doctrine_Core::getTable('user')->getUserProfile();
And I modified user_profile indexSucces.php to display sfGuardUser
data.   echo $user->getSfGuardUser()->getFirstName()
This is similar to http://www.symfony-project.org/jobeet/1_4/Doctrine/en/06

The problem is because I am basing my code on user table (I really
need to) when user logs in he/she sees a blank record due to the
leftJoin nature of Doctrine.  How do I do a rightJoin?
One solution I thought of is to modify sfDoctrineGuardPlugin so on
save it also inserts user_id in user table so the leftJoin would
return data but it just doesn't make sense you can't do rightJoin.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
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