Yii Framework Forum: Cannot Find Documentation For _App In Yiibase Class - Yii Framework Forum

Jump to content

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

Cannot Find Documentation For _App In Yiibase Class Rate Topic: -----

#1 User is offline   Trinh Duy Hung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 12

Posted 15 November 2012 - 01:32 AM

Hello everyone!

I'm learning yii framework and have a quite simple question.

We know that Yii::app() returns a CApplication object. When I consult to Yii api documentation for static method app() I see something like:
public static function app() 
{ 
    return self::$_app; 
}

But the thing is I couldn't find $_app inside yiiBase class. I'm wondering where does this guy $_app come from?

Thank in advanced!
0

#2 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 774
  • Joined: 02-July 10
  • Location:Central Poland

Posted 15 November 2012 - 02:25 AM

attribute definition is in 75 line of https://github.com/y...ork/YiiBase.php

setting the value of this attribute is done like this:
front controller (index.php) has this line of code:
Yii::createWebApplication( $config )->run();

this creates CApplication instance and calls run() method. During initialisation of CApplication there is a call to
Yii::setApplication($this);
in CApplication::__construct()

and that is all.
red
0

#3 User is offline   Trinh Duy Hung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 12

Posted 19 November 2012 - 01:19 AM

@redguy

Thank you!
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