mirror of
https://github.com/jbcr/core.git
synced 2026-04-29 03:33:24 +02:00
Update ExtensionCompilerPass.php
This commit is contained in:
@@ -30,7 +30,7 @@ class ExtensionCompilerPass implements CompilerPassInterface
|
||||
/* @see ExtensionRegistry::addCompilerPass() */
|
||||
$registry->addMethodCall('addCompilerPass', [$packages]);
|
||||
|
||||
// Rebuild our own `services_bolt.yml` file.
|
||||
// Rebuild our own `packages/bolt.yaml` file.
|
||||
$this->buildServices($packages);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ExtensionCompilerPass implements CompilerPassInterface
|
||||
$yaml = "# This file is auto-generated by Bolt. Do not modify.\n\n";
|
||||
$yaml .= Yaml::dump($services, 3);
|
||||
|
||||
$filename = $this->projectDir . '/config/services_bolt.yaml';
|
||||
$filename = $this->projectDir . '/config/packages/bolt.yaml';
|
||||
file_put_contents($filename, $yaml);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ class ExtensionCompilerPass implements CompilerPassInterface
|
||||
$reflection = new \ReflectionClass($package);
|
||||
|
||||
$namespace = Str::removeLast($reflection->getName(), Str::splitLast($reflection->getName(), '\\'));
|
||||
$path = Path::makeRelative(dirname($reflection->getFileName()), $this->projectDir . '/foo');
|
||||
$path = $this->getRelativePath($package);
|
||||
|
||||
return [$namespace, [
|
||||
'resource' => $path . '/*',
|
||||
'exclude' => $path . '/{Entity,Exception,Exclude}',
|
||||
'exclude' => $path . '/{Entity,Exception}',
|
||||
]];
|
||||
}
|
||||
|
||||
@@ -93,4 +93,12 @@ class ExtensionCompilerPass implements CompilerPassInterface
|
||||
|
||||
return array_unique($packages);
|
||||
}
|
||||
}
|
||||
|
||||
private function getRelativePath(string $package): string
|
||||
{
|
||||
$reflection = new \ReflectionClass($package);
|
||||
|
||||
// We add the `/foo/bar` to make the path start with `../../`
|
||||
return Path::makeRelative(dirname($reflection->getFileName()), $this->projectDir . '/foo/bar');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user