Jump to content
Larry Ullman's Book Forums

Yii Bootstrap - Where Is Run() Method Located?


Edward
 Share

Recommended Posts

Here is the Yii BootStrap code

 

<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();

 

I am confused as to where to find the run method in the YiiBase.php class i couldn't see it but can find the createWebApplication method with no problems.

Link to comment
Share on other sites

Whoops i spoke to soon found it in CApplication.php

 

public function run()
{
if($this->hasEventHandler('onbeginRequest'))
$this->onbeginRequest(new CEvent($this));
$this->processRequest();
if($this->hasEventHandler('onendRequest'))
$this->onendRequest(new CEvent($this));
}

 

Complicated stuff, Yii class extends YiiBase, then we call the static method which then calls another method within the class to create a new class and return its instance where by then we can use the run method.

 

Reading the YiiBook is one thing, but investing all those Classes is another.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...