1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Fixed getLoadedModels()

This commit is contained in:
wernerm 2007-11-23 00:25:28 +00:00
parent 86939d83bd
commit 54050f8c81

View File

@ -543,8 +543,8 @@ final class Doctrine
$loadedModels = array(); $loadedModels = array();
foreach ((array) $classes as $name) { foreach ((array) $classes as $name) {
try { try {
$declaredBefore = get_declared_classes();
$class = new ReflectionClass($name); $class = new ReflectionClass($name);
if (self::isValidModelClass($class)) { if (self::isValidModelClass($class)) {
$loadedModels[] = $name; $loadedModels[] = $name;
@ -554,11 +554,10 @@ final class Doctrine
// The possibility exists that the class name(s) contained in the model // The possibility exists that the class name(s) contained in the model
// file is not the same as the actual model file name itself // file is not the same as the actual model file name itself
if (isset(self::$_loadedModels[$name])) { if (isset(self::$_loadedModels[$name])) {
$declaredBefore = get_declared_classes();
try { try {
$tmp = self::$_loadedModels[$name];
require_once self::$_loadedModels[$name]; require_once self::$_loadedModels[$name];
$declaredAfter = get_declared_classes(); $declaredAfter = get_declared_classes();
// Using array_slice since array_diff is broken is some versions
$foundClasses = array_slice($declaredAfter, count($declaredBefore)-1); $foundClasses = array_slice($declaredAfter, count($declaredBefore)-1);
if ($foundClasses) { if ($foundClasses) {
foreach ($foundClasses as $name) { foreach ($foundClasses as $name) {
@ -575,7 +574,6 @@ final class Doctrine
} }
} }
return $loadedModels; return $loadedModels;
} }