Use YII Data Access Layer -DAO as a library from another full aplication

Any Idea abou how to

Use YII Data Access Layer -DAO as a library from another full aplication

need only include this lines in a file persistent like a conf.php under the aplication requering this librarys?



// include Yii bootstrap file


require_once(dirname(__FILE__).'/../../framework/yii.php');





// create a Web application instance and run


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


 

regards

Max

Yeah, that's enough. You may want to extend the application class so that it doesn't call controller action, though.

I try but…






Fatal error: Uncaught exception 'CException' with message 'Application base path "protected" is not a valid directory.' in /home/devm/public_html/framework/base/CApplication.php:207 Stack trace: #0 /home/devm/public_html/framework/base/CApplication.php(107): CApplication->setBasePath('protected') #1 /home/devm/public_html/framework/YiiBase.php(74): CApplication->__construct(NULL) #2 /home/devm/public_html/top25/sistema/mod/cpd/exportaru.php(9): YiiBase::createWebApplication() #3 {main} thrown in /home/devm/public_html/framework/base/CApplication.php on line 207


  





mmm

EDITED:

after 'protected' directory created:



Page Not Found


Unable to resolve the request "site".


The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. 





If you think this is a server error, please contact the webmaster





Create a such a directory (under the directory that contains the script instantiating the application instance.)

Quote

You may want to extend the application class


require_once(DIRETORIO_GEN.'/../framework/yii.php');





// create a Web application instance and run


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





comment this line?

//Yii::createWebApplication()->run();

or add any code here like

Class supercontroller expended controller

{

any code here?

}



class MyApplication extends CWebApplication {


    public function processRequest() {}


}


Then, in your bootstrap file create the application this way:



require_once('/path/to/yii.php');


require_once('path/to/MyApplication.php');


$app=new MyApplication($configFile);


$app->run();


That's all. We need $app here because Yii DB relies on the 'db' component.

wooww!!!

Thanks, working

:)

Now I can access all YII classes from my OLD app??

Can I start building modules compatible with YII under my old app, and in nexts months conplete migrate to YII

this is TRUE??

regards