- πΊπΈUnited States effulgentsia
There's a use-case for this in π Add symfony/config to core's dependencies for package_manager Closed: duplicate .
- π¬π§United Kingdom longwave UK
We have autowiring and autoconfiguration now; this would be useful so you could say
services: _defaults: autowire: true autoconfigure: true Drupal\module\EventSubscriber\: resource: 'src/EventSubscriber'
and then the container would automatically discover all event subscribers in that directory; to add a new one, you just add a new file and rebuild the container. We could even implement this sort of thing by default for modules so they don't necessarily have to write a services.yml at all!
However, there is quite a lot of Symfony code to port over. YamlFileLoader relies on the parent FileLoader class to do a bunch of discovery work here. The two options are:
- Copy and refactor a number of methods from Symfony into YamlFileLoader
- Implement β¨ Use native Symfony YamlLoader + Config Needs work
Symfony's container has diverged quite a lot from ours. I am leaning towards option 2 as it is simply a lot less work, and we would get all Symfony 3/4/5/6's features that we haven't implemented yet for free or almost free.
- π¦πΊAustralia dpi Perth, Australia
I've created an alternative proposal to
resource
that'll help us advance an equivalent more suitable in the Drupal context @ β¨ Directory based automatic service creation Needs review .Perhaps it'll be easier to get something more Drupaly in.