Search code examples
phpsymfony1doctrinesfguardsymfony-1.4

how can i get ID in sfDoctrineGuardPlugin?


I was creating its own login system, but all recommmended sfDoctrineGuardPlugin. unfortunately I dont understand this...

I go to http://localhost/frontend_dev.php/login and i logged in. i am in class sfGuardSecurityUser and method public function signIn($user, $remember = false, $con = null) where there did variable $user?

there is:

$this->setAttribute('user_id', $user->getId(), 'sfGuardSecurityUser');

but if i use:

$this->getUser()->getAttribute('user_id');

in own module then it is NULL. Works only $this->getUser(); but this is only Name and login. How can i get ID logged user?

I also added in table sf_guard_user_permission user_id 2 permission_id 2 and how can i check this in other module?

Thanks for help!


Solution

  • This is simple, in an action for exemple : $this->getUser()->getGuardUser()->getId();