This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » strange thing: $this->getUser()->getGuardUser()->getId() before query
strange thing: $this->getUser()->getGuardUser()->getId() before query [message #75314] Fri, 20 March 2009 18:03 Go to next message
dziobacz  is currently offline dziobacz
Messages: 86
Registered: February 2009
Member
I have in file action.class.php - this site is only for log in
persons:
$id = $this->getUser()->getGuardUser()->getId();

        $this->friends = Doctrine_Query::create()
          ->select('s1.*, s2.username as username')
          ->from('SfGuardUserProfile s1')
          ->innerJoin('s1.SfGuardUser s2')
          ->innerJoin('s2.Friends z ON s2.id=z.id_friend')
          ->where('z.id_user = ?', $id)
          ->execute();

I have an error: "Unknown relation alias Friends".
If I make:
$id = 2;

        $this->friends = Doctrine_Query::create()
          ->select('s1.*, s2.username as username')
          ->from('SfGuardUserProfile s1')
          ->innerJoin('s1.SfGuardUser s2')
          ->innerJoin('s2.Friends z ON s2.id=z.id_friend')
          ->where('z.id_user = ?', $id)
          ->execute();

$id = $this->getUser()->getGuardUser()->getId();

Everything is ok !! I displayed $this->getUser()->getGuardUser()->getId
() and it shows id log in person, for example '2'. What is going on ?
Why can't I use $this->getUser()->getGuardUser()->getId() before my
query ??
Sad

[Updated on: Fri, 20 March 2009 18:03]

Re: strange thing: $this->getUser()->getGuardUser()->getId() before query [message #75382 is a reply to message #75314 ] Sun, 22 March 2009 09:50 Go to previous message
colnector
Messages: 162
Registered: July 2008
Senior Member
What is the result of $this->getUser()->getGuardUser()->getId()
?

Try something like
$id = intval($this->getUser()->getGuardUser()->getId());

check the variable's value before execution and see what happens.


Colnect Collectors Club Community
http://colnect.com

http://i.colnect.net/images/colnect_logo_255.png
Previous Topic:Modify script to use tabs
Next Topic:"clear:cache" from within an action
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software