Yii Framework Forum: Basic things about Yii::app() properties - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Basic things about Yii::app() properties CApplication Rate Topic: -----

#1 User is offline   nettrinity 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 15-March 11

Posted 17 March 2011 - 12:24 PM

I am trying to make sense of the following code generated by Gii:

	public function actionLogout()
	{
            
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->homeUrl);
	}

Please correct if I am wrong:
1) Yii::app() will return the CApplication, right?
2) then I go to the Class reference document to find out about user and homeUrl, since app()->user, and Yii::app()->homeUrl make me think user and homeUrl are the property of CApplication.
3) But I couldn't find user and homeUrl within the property list in the class inheritance tree.
4) Can you tell me where I am wrong?

Thank you!

Nicolas
0

#2 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 17 March 2011 - 12:30 PM

Yii::app() returns CWebApplication instance (for web-applications of course :) )
0

#3 User is offline   nettrinity 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 15-March 11

Posted 17 March 2011 - 12:34 PM

View Postandy_s, on 17 March 2011 - 12:30 PM, said:

Yii::app() returns CWebApplication instance (for web-applications of course :) )



but I couldn't find user and homeUrl in CApplication's property list. Do yo know why?
0

#4 User is offline   nettrinity 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 15-March 11

Posted 17 March 2011 - 12:36 PM

View Postandy_s, on 17 March 2011 - 12:30 PM, said:

Yii::app() returns CWebApplication instance (for web-applications of course :) )



ohhhh, I see.
It's CWebApplication, not CApplication. Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users