8000 New bundle path convention when AbstractBundle is used · symfony/symfony@39fa4f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39fa4f3

Browse files
committed
New bundle path convention when AbstractBundle is used
1 parent 123b165 commit 39fa4f3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Symfony/Component/HttpKernel/Bundle/AbstractBundle.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,17 @@ public function getContainerExtension(): ?ExtensionInterface
4747

4848
return $this->extension ??= new BundleExtension($this, $this->extensionAlias);
4949
}
50+
51+
/**
52+
* {@inheritdoc}
53+
*/
54+
public function getPath(): string
55+
{
56+
if (null === $this->path) {
57+
$reflected = new \ReflectionObject($this);
58+
$this->path = \dirname($reflected->getFileName(), 2);
59+
}
60+
61+
return $this->path;
62+
}
5063
}

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
* Add `Profiler::isEnabled()` so collaborating collector services may elect to omit themselves
1111
* Add the `UidValueResolver` argument value resolver
1212
* Add `AbstractBundle` class for DI configuration/definition on a single file
13+
* Update the path of a bundle placed in the `src/` directory to the parent directory when `AbstractBundle` is used
1314

1415
6.0
1516
---

0 commit comments

Comments
 (0)
0