When you need to integrate with other frameworks (e.g. Zend Framework), you have to follow these steps:
Yii::import('application.vendors.<frameworkName>.*')I saw this hint in this forum thread and adopted it to Zend:
require_once 'Zend/Loader/Autoloader.php'; spl_autoload_unregister(array('YiiBase','autoload')); spl_autoload_register(array('Zend_Loader_Autoloader','autoload')); spl_autoload_register(array('YiiBase','autoload'));
Idea is the following. You unregister Yii's autoload function, then register framework's one and then Yii's one again. This leads to the effect, when php is trying to use 3rd party autoload first and loads correct classes. If none found (because you actually called Yii class), it tried Yii's autoload. So everything is OK :)
Total 4 comments
Chek all the PHP documentation about it...
If you have read the PHP documentation... you know that by using spl_autoload_register() you can register a custom auto-loading method to be used by PHP script...
Yii registers the method YiiBase::autoload() to be used as an autoload by PHP scripts - http://www.yiiframework.com/doc/api/1.1/YiiBase#autoload-detail
And what this wiki say to do (check again the code above) is to unregister that Yii method... register the zend autoloader... and then again register the Yii one...
Hope it clears your doubts..
That is PHP autoloader. How does it related to Yii?
For autoloading concept check the PHP documentation
http://php.net/manual/en/language.oop5.autoload.php
Maybe I am a beginner, but I haven't seen anything called Yii autoloader after reading the Guide. Are you talking about Yii::import()? or return array( 'class'=> application.component.xxxx, ...) ?
Leave a comment
Please login to leave your comment.