Yii 1.1: gautoloader

mindplay-dk's Fix for Namespaces
1 follower

This is just a repackage of mindplay-dk's GAutoloader https://gist.github.com/4234540

Requirements

Tested with Yii 1.1.13

Install and Usage

Extract under /protected/extensions/

//Add to config/main.php
//Add to Extensions
'import'=>array(...
    'application.extensions.gautoloader.*'
...),
 
//Add to Components
'components'=>array( ....
    'autoloader'=>array(
            'class'=>'ext.gautoloader.EAutoloader'
        ),
....),
 
 
//Your Application
//Usage
Yii::app()->autoloader->getAutoloader()->addNamespace('Yournamespace\goes\here', '/path/to/namespace');

Resources

Thank mindplay-dk for this fix. https://gist.github.com/4234540

Total 1 comment

#11663 report it
rapidtransit440 at 2013/01/25 09:51am
Made a few mistakes it's now corrected

In EAutoloader I added:

//Before Class Declaration
require('GAutoloader.php');
 
 
//function autoload
//Changed return parent::autoload($className); to
return Yii::autoload($className);
 
//Bottom line changed
//spl_autoload_register(array('Yii','autoload')); to
spl_autoload_register(array('EAutoloader','autoload'));

Leave a comment

Please to leave your comment.

Create extension