Skip to content

Commit 4d2459d

Browse files
committed
New bundle path convention when AbstractBundle is used
1 parent aec0685 commit 4d2459d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Bundle/AbstractBundle.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,18 @@ 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+
// assume the modern directory structure by default
59+
$this->path = \dirname($reflected->getFileName(), 2);
60+
}
61+
62+
return $this->path;
63+
}
5064
}

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)