A few more fixes for autoloading and locating paths to Doctrine components.
This commit is contained in:
parent
44820ec14a
commit
60c921762d
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user