Commit 60c92176 authored by Jonathan.Wage's avatar Jonathan.Wage

A few more fixes for autoloading and locating paths to Doctrine components.

parent 44820ec1
......@@ -1075,17 +1075,9 @@ final class Doctrine
self::$_path = dirname(__FILE__);
}
$findPattern = self::$_path . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, str_replace('Doctrine_', '', $className)) . '.php';
$matches = glob($findPattern);
if ( ! isset($matches[0])) {
return false;
}
$class = $matches[0];
$class = self::locate($className . '.php');
if (file_exists($class)) {
if ($class && file_exists($class)) {
require $class;
return true;
......@@ -1101,6 +1093,19 @@ final class Doctrine
return false;
}
public static function locate($name)
{
$findPattern = self::$_path . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, str_replace('Doctrine_', '', $name));
$matches = glob($findPattern);
if ( isset($matches[0])) {
return $matches[0];
} else {
return false;
}
}
/**
* dump
......
......@@ -329,7 +329,7 @@ class Doctrine_Lib
{
$validators = array();
$dir = Doctrine::getPath() . DIRECTORY_SEPARATOR . 'Doctrine' . DIRECTORY_SEPARATOR . 'Validator';
$dir = Doctrine::locate('Doctrine_Validator');
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($files as $file) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment