Skip to content

[FrameworkBundle] Remove DI, Entity and Kernel exclusion from the default services file #20871

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
Apr 9, 2025
Merged
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
13 changes: 3 additions & 10 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ each time you ask for it.
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'

# order is important in this file because service definitions
# always *replace* previous ones; add your own service configuration below
Expand All @@ -187,7 +183,7 @@ each time you ask for it.

<!-- makes classes in src/ available to be used as services -->
<!-- this creates a service per class whose id is the fully-qualified class name -->
<prototype namespace="App\" resource="../src/" exclude="../src/{DependencyInjection,Entity,Kernel.php}"/>
<prototype namespace="App\" resource="../src/"/>

<!-- order is important in this file because service definitions
always *replace* previous ones; add your own service configuration below -->
Expand All @@ -212,18 +208,15 @@ each time you ask for it.

// makes classes in src/ available to be used as services
// this creates a service per class whose id is the fully-qualified class name
$services->load('App\\', '../src/')
->exclude('../src/{DependencyInjection,Entity,Kernel.php}');
$services->load('App\\', '../src/');

// order is important in this file because service definitions
// always *replace* previous ones; add your own service configuration below
};

.. tip::

The value of the ``resource`` and ``exclude`` options can be any valid
`glob pattern`_. The value of the ``exclude`` option can also be an
array of glob patterns.
The value of the ``resource`` option can be any valid `glob pattern`_.

Thanks to this configuration, you can automatically use any classes from the
``src/`` directory as a service, without needing to manually configure
Expand Down
Loading