Skip to content

Commit e517271

Browse files
authored
Merge pull request #5 from agallou/fix_autoload_components
fix autoloading of symfony components
2 parents 5124637 + aa62384 commit e517271

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

autoloader.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,24 @@
1414
atoum\autoloader::get()
1515
->addNamespaceAlias('atoum\config', __NAMESPACE__)
1616
->addDirectory(__NAMESPACE__, __DIR__ . DIRECTORY_SEPARATOR . 'classes')
17-
->addDirectory('Symfony\Component\Config', $vendorDirectory . '/symfony/config/Symfony/Component/Config')
18-
->addDirectory('Symfony\Component\DependencyInjection', $vendorDirectory . '/symfony/dependency-injection/Symfony/Component/DependencyInjection')
19-
->addDirectory('Symfony\Component\FileSystem', $vendorDirectory . '/symfony/filesystem/Symfony/Component/FileSystem')
20-
->addDirectory('Symfony\Component\Yaml', $vendorDirectory . '/symfony/yaml/Symfony/Component/Yaml')
2117
;
18+
19+
20+
21+
$components = array(
22+
'config' => 'Config',
23+
'dependency-injection' => 'DependencyInjection',
24+
'filesystem' => 'FileSystem',
25+
'yaml' => 'Yaml',
26+
);
27+
28+
foreach ($components as $componentKey => $componentName) {
29+
$componentDir = $vendorDirectory . '/symfony/' . $componentKey . '/Symfony/Component/' . $componentName;
30+
if (!is_dir($componentDir)) {
31+
$componentDir = $vendorDirectory . '/symfony/' . $componentKey;
32+
}
33+
atoum\autoloader::get()
34+
->addDirectory('Symfony\Component\\' . $componentName, $componentDir)
35+
;
36+
}
37+

0 commit comments

Comments
 (0)