Update bundle page to reflect best practices #15881
Fix documentation to reflect best practices page: https://symfony.com/doc/5.4/bundles/best_practices.html#directory-structure
See: #15881
Hey!
Oh no, it looks like you have made this PR towards a branch that is not maintained anymore. :/ Could you update the PR base branch to target one of these branches instead? 4.4, 5.3, 5.4, 6.0, 6.1.
Cheers!
Carsonbot
It appears that the recommended bundle directory structure does not work by default: https://github.com/symfony/symfony-docs/issues/15881
Perhaps the extra steps needed to make it work also needs to be documented.
Additionally, many (most?) Symfony bundles use the old directory structure.
It appears that the recommended bundle directory structure does not work by default: #15881
Perhaps the extra steps needed to make it work also needs to be documented.
I'd say add the one extra step needed to https://github.com/BafS/symfony-docs/blob/patch-9/bundles.rst#creating-a-bundle - specifically, you need to override the getPath() method:
public function getPath(): string
{
return \dirname(__DIR__);
}
Additionally, many (most?) Symfony bundles use the old directory structure.
The bundles in the Symfony monorepo probably will never change unless the framework forces a change. In the ecosystem, I imagine between this stuff being documented and Symfony 3.4 support being dropped, it might get some more uptake.
Closing because this article was updated a while ago ... and we're updating the remaining articles to always prioritize the new dir structure and the AbstractBundle class. See #19793
Thanks!