mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-23 16:22:10 +01:00
Merge branch '6.4' into 7.3
* 6.4: Minor tweak [DependencyInjection] Add example for `#[Exclude]` attribute
This commit is contained in:
@@ -1378,7 +1378,16 @@ key. For example, the default Symfony configuration contains this:
|
||||
The value of the ``resource`` and ``exclude`` options can be any valid
|
||||
`glob pattern`_. If you want to exclude only a few services, you
|
||||
may use the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Exclude`
|
||||
attribute directly on your class to exclude it.
|
||||
attribute directly on your class to exclude it::
|
||||
|
||||
// src/Service/SomeService.php
|
||||
namespace App\Service;
|
||||
|
||||
#[Exclude]
|
||||
class SomeService
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
This can be used to quickly make many classes available as services and apply some
|
||||
default configuration. The ``id`` of each service is its fully-qualified class name.
|
||||
|
||||
Reference in New Issue
Block a user