🌐 AI搜索 & 代理 主页
Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Take modern bundle structure into account
  • Loading branch information
jdreesen committed Jun 27, 2022
commit 0e68677f9aebc92b13abd23fdd092d28b607988e
19 changes: 7 additions & 12 deletions bundles/CoreBundle/DependencyInjection/Compiler/AreabrickPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,19 @@ protected function handleContainerAwareDefinition(ContainerBuilder $container, D
*/
protected function findBundleBricks(ContainerBuilder $container, string $name, array $metadata, array $excludedClasses = []): array
{
$directory = implode(DIRECTORY_SEPARATOR, [
$metadata['path'],
'Document',
'Areabrick',
]);
$sourcePath = is_dir($metadata['path'].'/src') ? $metadata['path'].'/src' : $metadata['path'];
$directory = $sourcePath.'/Document/Areabrick';

// update cache when directory is added/removed
$container->addResource(new FileExistenceResource($directory));

if (!file_exists($directory) || !is_dir($directory)) {
if (!is_dir($directory)) {
return [];
} else {
// update container cache when areabricks are added/changed
$container->addResource(new DirectoryResource($directory, '/\.php$/'));
}

// update container cache when areabricks are added/changed
$container->addResource(new DirectoryResource($directory, '/\.php$/'));

$finder = new Finder();
$finder
->files()
Expand All @@ -230,7 +227,7 @@ protected function findBundleBricks(ContainerBuilder $container, string $name, a
$shortClassName = $classPath->getBasename('.php');

// relative path in bundle path
$relativePath = str_replace($metadata['path'], '', $classPath->getPathInfo());
$relativePath = str_replace($sourcePath, '', $classPath->getPathInfo());
$relativePath = trim($relativePath, DIRECTORY_SEPARATOR);

// namespace starting from bundle path
Expand All @@ -257,8 +254,6 @@ protected function findBundleBricks(ContainerBuilder $container, string $name, a
$areas[] = [
'brickId' => $brickId,
'serviceId' => $serviceId,
'bundleName' => $name,
'bundleMetadata' => $metadata,
'reflector' => $reflector,
];
}
Expand Down