sfAutoload::register PHP Method

register() public static method

Register sfAutoload in spl autoloader.
public static register ( ) : void
return void
    public static function register()
    {
        ini_set('unserialize_callback_func', 'spl_autoload_call');
        if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
            throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
        }
    }

Usage Example

 public static function register()
 {
     if (!self::$registered) {
         set_include_path(realpath(dirname(__FILE__) . '/vendor/Elastica/lib') . PATH_SEPARATOR . get_include_path());
         sfAutoload::register(array('sfElasticSearch', 'autoload'));
         self::$registered = true;
     }
 }