Skip to content
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

Extend AbstractBundle instead of Bundle #19873

Merged
merged 1 commit into from
May 13, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,22 @@ The following is the recommended directory structure of an AcmeBlogBundle:
├── LICENSE
└── README.md

This directory structure requires to configure the bundle path to its root
directory as follows::
.. note::

This directory structure is used by default when your bundle class extends
the recommended :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle`.
If your bundle extends the :class:`Symfony\\Component\\HttpKernel\\Bundle\\Bundle`
class, you have to override the ``getPath()`` method as follows::

class AcmeBlogBundle extends Bundle
{
public function getPath(): string
use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeBlogBundle extends Bundle
{
return \dirname(__DIR__);
public function getPath(): string
{
return \dirname(__DIR__);
}
}
}

**The following files are mandatory**, because they ensure a structure convention
that automated tools can rely on:
Expand Down
4 changes: 2 additions & 2 deletions service_container/compiler_passes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ method in the extension)::

use App\DependencyInjection\Compiler\CustomPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;

class MyBundle extends Bundle
class MyBundle extends AbstractBundle
{
public function build(ContainerBuilder $container): void
{
Expand Down