Skip to content

[HttpKernel] New bundle path convention when AbstractBundle is used #46385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions src/Symfony/Component/HttpKernel/Bundle/AbstractBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,18 @@ public function getContainerExtension(): ?ExtensionInterface

return $this->extension ??= new BundleExtension($this, $this->extensionAlias);
}

/**
* {@inheritdoc}
*/
public function getPath(): string
{
if (null === $this->path) {
$reflected = new \ReflectionObject($this);
// assume the modern directory structure by default
$this->path = \dirname($reflected->getFileName(), 2);
}

return $this->path;
}
}
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpKernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CHANGELOG
* Add `Profiler::isEnabled()` so collaborating collector services may elect to omit themselves
* Add the `UidValueResolver` argument value resolver
* Add `AbstractBundle` class for DI configuration/definition on a single file
* Update the path of a bundle placed in the `src/` directory to the parent directory when `AbstractBundle` is used

6.0
---
Expand Down