symfony exclude class from autowiring
To exclude a class from autowiring in Symfony, you can use the exclude
option in the services.yaml
configuration file. Here's the syntax to exclude a class from autowiring:
services:
# ...
App\Excluded\Class:
autowire: false
In this example, App\Excluded\Class
is the fully qualified name of the class that you want to exclude from autowiring. By setting autowire
to false
, Symfony will no longer autowire this class.
Make sure to replace App\Excluded\Class
with the actual namespace and class name that you want to exclude.
That's it! The specified class will now be excluded from autowiring in your Symfony application.