Change record status: 
Project: 
Introduced in branch: 
Introduced in version: 
Description: 

Modules may now opt to automatically convert classes in directories to services.

  • Services are created based on a a service entry in services.yml, where the service is used as a template for the created services.
  • The service ID for the service entry services.yml is discarded.
  • Customizing the generated service ID is currently not possible.
  • A service per class is created, whose ID is the fully-qualified class name, allowing for autowiring.
  • A service is not created if one already exists with the same class.

Only directories belonging to a module

A module may choose to convert all classes in its src/ or a specific subdirectory, to a service.

services.yml

services:
  mymodule.foobar: # ID is not used for the created services.
    module: 
      paths: # relative to module-in-context root dir.
        - '/src/'

    autowire: true
    autoconfigure: true
    tags:
      - { name: tag_copied_to_all_services }

Directories belonging to any module

A module may choose to convert a specific subdirectory in all other modules, to a service.

services.yml

services:
  mymodule.foobar: # ID is not used for the created services.
    modules:
      paths: # relative to all enabled modules' root dir.
        - '/src/APathInAllModules/'

    autowire: true
    autoconfigure: true
    tags:
      - { name: tag_copied_to_all_services }