1
0
mirror of synced 2025-01-29 19:41:45 +03:00

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

This commit is contained in:
Jonathan.Wage 2008-01-05 07:53:24 +00:00
parent 44820ec14a
commit 60c921762d
2 changed files with 16 additions and 11 deletions

View File

@ -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

View File

@ -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) {