Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,23 @@ private function registerAnnotationLoaders(ContainerBuilder $container)
*/
private function registerFileLoaders(ContainerBuilder $container)
{
$prefix = DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR;
$yamlResources = [];
$xmlResources = [];

foreach ($container->getParameter('kernel.bundles') as $bundle) {
$reflectionClass = new \ReflectionClass($bundle);
$configDirectory = dirname($reflectionClass->getFileName()).$prefix;
$yamlResources = array_merge($yamlResources, glob($configDirectory.'api_resources.{yml,yaml}'));

foreach (Finder::create()->files()->in($configDirectory)->path('api_resources')->name('*.{yml,yaml}') as $file) {
$yamlResources[] = $file->getRealPath();
}

$xmlResources = array_merge($xmlResources, glob($configDirectory.'api_resources.xml'));

foreach (Finder::create()->files()->in($configDirectory)->path('api_resources')->name('*.xml') as $file) {
$xmlResources[] = $file->getRealPath();
$configDirectory = dirname($reflectionClass->getFileName()).'/Resources/config/';

try {
foreach (Finder::create()->files()->in($configDirectory)->path('api_resources')->name('*.{yml,yaml,xml}') as $file) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api_resources.{yml,yaml,xml} doesn't seem to be loaded anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behat is requiring both to be loaded to pass if I remember correctly. If it's not the case, there's a missing test case.

if ('xml' === $file->getExtension()) {
$xmlResources[] = $file->getRealPath();
} else {
$yamlResources[] = $file->getRealPath();
}
}
} catch (\InvalidArgumentException $e) {
// Ignore invalid paths
}
}

Expand Down