m.. m.. - 4 months ago 20
PHP Question

Need explanation on how Yii::app()->name works

Hello guys I was confused to what Yii::app()->name meant. I know that Yii::app() is calling the static function app() in the YiiBase class, but there is no property name in that same class, can someone explain.

Answer

In CApplication there is a public property named 'name'

http://www.yiiframework.com/doc/api/1.1/CApplication

name property public string $name; the application name. Defaults to 'My Application'.

this mean that

 Yii::app()->name 

simply refer to the name public attribute

in index.php you have

Yii::createWebApplication($config)->run();

In Yii YiibBase class the

createWebApplication()  
{return}    CWebApplication 

and CWebApplication http://www.yiiframework.com/doc/api/1.1/CWebApplication

extend CApplication ..

Inheritance class CWebApplication » CApplication » CModule » CComponent