Skip to content

#149 - Define the tasks and transformers services explicitly - #291

Merged
njoubert-cleverage merged 1 commit into
mainfrom
149
Oct 14, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
149

Conversation

@njoubert-cleverage

@njoubert-cleverage njoubert-cleverage commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

The service ids are finalized by #91 (PR #294): the tasks and transformers keep their class name as service id, and fetching them directly from the service container is deprecated (private in v6.0).

Description

Fixes #149 (step 2: task, transformer): apply the best practices for reusable bundles to the tasks and transformers services, which were loaded as autowired resources (autowire: true, autoconfigure: true for the transformers, bind).

Changes

  • config/services/task.yaml (58 tasks) and config/services/transformer.yaml (37 transformers): one explicit definition per service, in the same format as the bridge bundles:
    • the class name as service id, as before;
    • explicit arguments, shared: false for the tasks, tags in _defaults (monolog.logger on cleverage_process_task / cleverage_process_transformer, cleverage.transformer);
  • How the definitions were written: generated from the previously autowired definitions, dumped from a compiled container (removing passes disabled, so nothing inlined): all 95 definitions only had constructor arguments (no method calls, properties nor factories), and every constructor parameter was resolved (no default omitted). The monolog channel loggers are written @logger (the monolog.logger tag gives the channel), the debug event dispatcher @event_dispatcher.
  • Docs: task definition reference.
  • CHANGELOG (Latest).

Checks

  • Equivalence: the same dump after the change, by class, compared with the autowired one: same arguments, tags, shared, method calls, factories for the 95 classes.
  • Demo project (main + this change copied in vendor/, then reverted): lint:container OK, cleverage:process:help OK, demo.transformer, demo.transformer_list, demo.transformers_edge.cached, demo.mapping_array_target_path, demo.file.csv_reader, demo.archive.zip, demo.doctrine.entitymanager.writer / batch_writer executed (demo.rest.get fails on the external IGN API, also without this change).
  • After composer update: 929 tests OK, PHPStan, PHP-CS-Fixer, Rector OK.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None for the documented usages (same service ids, same arguments). Edge cases (minor):

  • the arguments were autowired from the application aliases; they are now wired to the services themselves (@property_accessor, @serializer, @validator, @logger, @cache.app, @kernel…): an application that replaced e.g. the PropertyAccessorInterface alias by its own implementation no longer gets it in these tasks / transformers (decorating the property_accessor service still works);

🤖 Generated with Claude Code

Step 2 of the Symfony best practices for the bundle services: no more
autowiring, autoconfiguration nor bindings for the tasks and transformers.

- config/services/task.yaml / transformer.yaml: one explicit definition per
  task (58) and transformer (37), with a private cleverage_process.task.* /
  cleverage_process.transformer.* id and a public alias named after the class
  (service references by class, autowiring by class and $container->get() keep
  working). Same arguments, tags and shared settings as the previously
  autowired definitions (generated from them, then compared: identical).
- UnavailableServicesCompilerPass: resolves the services through their class
  alias.
- Tests and documentation updated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply Symfony best practices - Services

1 participant