Repository navigation
#91 - Reference the tasks by a code in the process configurations - #294
Merged
Merged
Conversation
- New "task" key in the task configuration (task: transformer), mutually exclusive with "service" (one of them required). - The code of a task service is declared with the new "code" attribute of the cleverage.task tag, or the new #[AsTask(code: '...')] attribute (autoconfiguration). The 58 tasks of the bundle are tagged with their code (end of their service id: snake case of the class name without "Task"). - TaskLocatorCompilerPass resolves the codes into the "service" of the configurations (raw configuration: parameters not resolved) when the container is compiled; unknown, duplicate or invalid codes fail the compilation. ProcessConfigurationRegistry throws an explicit exception for a code that was not resolved (configuration added at runtime). - Documentation: task definition reference, quick start, custom tasks (#[AsTask]), the code on the reference page of every task. Tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… uses the task codes
- The "service" option of a task configuration is deprecated since 5.4
(setDeprecated() of the configuration node: only for the tasks that set it),
removed in v6.0: reference the task by its code ("task: <code>"), and give a
code to the application tasks with #[AsTask] or a "cleverage.task" tag.
- Documentation: "task" is the required attribute, "service" is documented as
deprecated; the 142 examples referencing a task of the bundle by its service
use its code, the application task examples too.
- Test of the deprecation.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…recate their direct access - Tasks and transformers keep their class name as service id (as in 5.3): the cleverage_process.task.* / cleverage_process.transformer.* ids and the class aliases added by #149 (not released) are removed, the codes being the short way to reference them. - They stay public, but fetching them directly from the service container is deprecated since 5.4 (container.private tag: the references of the container, e.g. the task and transformer locators, use the private service, without deprecation); private in v6.0. - CHANGELOG (Latest) aligned: #149 and #91 entries describe the final state. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3 of 4 tasks
- Task definition reference and #[AsTask]: a task code is unique (two task services with the same code fail the container compilation), use a prefix for the application tasks. - Task definition reference: the deprecated "service" is a service id (the class name for the tasks of this bundle); the examples of service aliases and of the bridge service ids are removed. - Advanced workflow: the process manager can be autowired by its class (alias added by #272). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 15, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #91: reference a task by a short code instead of its service, as the transformers (#276):
Changes
taskkey, next tooptions. A task defines eithertaskorservice(A task must define either its code ("task: <code>") or, deprecated, its "service", not both). Namedtaskrather thancode: the task list usesuseAttributeAsKey('code'), and Symfony re-keys any task containing acodeattribute (even under a string YAML key) and removes it.servicedeprecated since 5.4, removed in v6.0 (setDeprecated()of the configuration node, so only for the tasks that set it, at container compilation, collected in the container deprecations log / profiler):The "service" option of the task "clever_age_process.configurations.<process>.tasks.<task>" is deprecated, reference the task by its code instead ("task: <code>", given on the reference page of each task; give a code to your own tasks with #[AsTask] or a "cleverage.task" tag). It will be removed in v6.0.It keeps working, with all its forms, until v6.0.codeattribute of a newcleverage.tasktag, and new#[CleverAge\ProcessBundle\Attribute\AsTask(code: '...')]attribute (registerAttributeForAutoconfiguration()), as#[AsTransformer].Task:transformer,constant_output,constant_iterable_output,csv_reader,csv_writer,input_iterator,file_writer,debug,stop… (a test checks that every bundle task has a unique code).config/services/task.yaml/transformer.yamlas defined explicitly by Apply Symfony best practices - Services #149). They stay public, but fetching them directly from the service container is deprecated since 5.4 (container.privatetag, Symfony's mechanism:Accessing the "…" service directly from the container is deprecated, use dependency injection instead.); the references of the container, including the task and transformer locators, use the private service, without deprecation. They will be private in v6.0 (v6.0: remove the deprecated code #292). Autowiring by class and decoration keep working.TaskLocatorCompilerPass, Fetch tasks from a service locator instead of the service container (v5 step of #114) #275): thetaskcodes are replaced by theserviceof the tagged service (@<class>) in the configurations given toProcessConfigurationRegistry— only theservicekey is set, on the raw configuration, so the parameters / escaped%%of the configurations are untouched — then the service goes in the task locator. An unknown code fails the container compilation, with the list of the known codes (Unknown task code "x" for the task "t" of the process "p". Known codes: "…"); duplicate or empty codes too.ProcessConfigurationRegistry: explicitLogicExceptionfor a task without service (ataskcode in a configuration added at runtime, which cannot be resolved).taskrequired,servicedocumented as deprecated), quick start (minimal syntax), custom tasks (new "Task code" section,#[AsTask], tag without autoconfiguration), the code (* **Code**: \transformer` (`task: transformer`)`) on the reference page of the 58 tasks and in the page template. All the examples use the codes: the 142 references to a task of the bundle by its service (67 files) were converted with the class → code table, the application task examples too.To do before releasing 5.4 (else the users of the bridges get the deprecation without being able to use a code): give a code to the tasks of the bridge bundles (one issue per bridge), migrate the demo processes (400
servicedeprecations in its container build log), and #292 (v6.0: removeservice, tasks and transformers private) is updated.Checks
constant_output→transformer→app_upper, an application task with#[AsTask]) gives the expected output, without deprecation; a process still usingserviceworks and gets the deprecation in the container deprecations log;$container->get(<class>)of a task / a transformer gets thecontainer.privatedeprecation; an unknown code fails the boot with the list of the known codes.service; this change copied invendor/, then reverted):lint:containerOK,demo.transformer,demo.transformer_list,demo.file.csv_reader,demo.archive_zipexecuted.ConfigurationTest(task or service, neither / both rejected, deprecation ofserviceonly when set),TaskLocatorCompilerPassTest(codes resolved for bundle and application tasks, parameters untouched, unknown / duplicate / invalid code),CleverAgeProcessExtensionTest(unique code for every bundle task,#[AsTask]),ProcessConfigurationRegistryTest(unresolved code). 955 tests OK with code coverage (as the CI), PHPStan, PHP-CS-Fixer, Rector OK.Requirements
Breaking changes
None until v6.0:
servicekeeps working (deprecated), the tasks and transformers stay public (direct access deprecated). Minor:serviceis no longerisRequired()in the configuration tree (the "neither task nor service" case is still rejected, with a new message), andconfig:dump-referenceshows the newtaskkey.🤖 Generated with Claude Code