sfCoreAutoload::register PHP Method

register() public static method

Register sfCoreAutoload in spl autoloader.
public static register ( ) : void
return void
    public static function register()
    {
        if (self::$registered) {
            return;
        }
        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())));
        }
        self::$registered = true;
    }

Usage Example

 /**
  * Constructor.
  *
  * @param string              $rootDir    The project root directory
  * @param sfEventDispatcher   $dispatcher The event dispatcher
  */
 public function __construct($rootDir = null, sfEventDispatcher $dispatcher = null)
 {
     if (is_null(sfProjectConfiguration::$active) || $this instanceof sfApplicationConfiguration) {
         sfProjectConfiguration::$active = $this;
     }
     $this->rootDir = is_null($rootDir) ? self::guessRootDir() : realpath($rootDir);
     $this->symfonyLibDir = realpath(dirname(__FILE__) . '/..');
     // initializes autoloading for symfony core classes
     require_once $this->symfonyLibDir . '/autoload/sfCoreAutoload.class.php';
     sfCoreAutoload::register();
     $this->dispatcher = is_null($dispatcher) ? new sfEventDispatcher() : $dispatcher;
     ini_set('magic_quotes_runtime', 'off');
     ini_set('register_globals', 'off');
     sfConfig::set('sf_symfony_lib_dir', $this->symfonyLibDir);
     $this->setRootDir($this->rootDir);
     $this->setup();
 }
All Usage Examples Of sfCoreAutoload::register