1
0
mirror of synced 2025-01-20 15:31:40 +03:00

[2.0] Fixing issue with multiple class directory loading in Annotations driver

This commit is contained in:
guilhermeblanco 2010-01-27 22:04:37 +00:00
parent 8336bcc71c
commit 9d7bd7336c

View File

@ -346,25 +346,35 @@ class AnnotationDriver implements Driver
public function getAllClassNames()
{
if ($this->_classDirectory) {
$iter = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_classDirectory),
\RecursiveIteratorIterator::LEAVES_ONLY);
$declared = get_declared_classes();
foreach ($iter as $item) {
$info = pathinfo($item->getPathName());
if ( ! isset($info['extension']) || $info['extension'] != 'php') {
continue;
}
require_once $item->getPathName();
}
$declared = array_diff(get_declared_classes(), $declared);
$classes = array();
foreach ($declared as $className) {
if ( ! $this->isTransient($className)) {
$classes[] = $className;
foreach ((array) $this->_classDirectory as $dir) {
$iter = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->_classDirectory),
\RecursiveIteratorIterator::LEAVES_ONLY
);
$declared = get_declared_classes();
foreach ($iter as $item) {
$info = pathinfo($item->getPathName());
if ( ! isset($info['extension']) || $info['extension'] != 'php') {
continue;
}
require_once $item->getPathName();
}
}
$declared = array_diff(get_declared_classes(), $declared);
foreach ($declared as $className) {
if ( ! $this->isTransient($className)) {
$classes[] = $className;
}
}
}
return $classes;
} else {
return array();