Example #1
0
 /**
  * Get the root path to Doctrine
  *
  * @return string
  */
 public static function getPath()
 {
     if (!self::$_path) {
         self::$_path = dirname(__FILE__);
     }
     return self::$_path;
 }
Example #2
0
 /**
  * autoload
  *
  * simple autoload function
  * returns true if the class was loaded, otherwise false
  *
  * @param string $classname
  * @return boolean
  */
 public static function autoload($className)
 {
     if (class_exists($className, false)) {
         return false;
     }
     if (!self::$_path) {
         self::$_path = dirname(__FILE__);
     }
     $class = self::$_path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
     if (file_exists($class)) {
         require_once $class;
         return true;
     }
     $loadedModels = self::$_loadedModelFiles;
     if (isset($loadedModels[$className]) && file_exists($loadedModels[$className])) {
         require_once $loadedModels[$className];
         return true;
     }
     return false;
 }