Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Latest
## Fixes
* [#434](https://github.com/cleverage/process-bundle/issues/434) Signals: when the same SIGINT or SIGTERM is received again while a process is running, the command exits right away, as documented. The console application dispatches the same event at each signal, whose exit stayed aborted by the first signal. Add tests.
* [#436](https://github.com/cleverage/process-bundle/issues/436) `xpath_evaluator`: a boolean expression whose value is `false` (`boolean()`, `not()`, a false comparison) returns `false`, instead of throwing `Invalid xpath query '...': unknown error`. Only an expression reporting libxml errors is invalid. Add tests.
* [#438](https://github.com/cleverage/process-bundle/issues/438) Generic transformers: the codes of their `transformers` and `contextual_options` keep their dashes, as the codes of the processes, tasks and generic transformers since 5.7. A generic transformer referencing a generic transformer whose code has a dash no longer triggers the deprecation of its former name, and a transformer service whose code has a dash is found. Update documentation, add tests.

v5.8
-----
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/03-generic_transformers_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ clever_age_process:
```

As any transformer code, generic transformer codes must be unique: use a prefix to avoid conflicts. A dash is kept in
the code (it was replaced by an underscore before 5.7, the former name is deprecated).
the code (it was replaced by an underscore before 5.7, the former name is deprecated), as in the codes of the
transformers and of the contextual options of a generic transformer.
4 changes: 4 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@ protected function appendTransformerConfigDefinition(NodeBuilder $definition): v
->arrayNode('contextual_options')
->info('Options of the transformer (code: definition with required, default, default_is_null), injected in the "transformers" with "{{ code }}"')
->example(['delimiter' => ['default' => ',']])
// Keep the dashes of the option codes, as written in the options given to the transformer and in "{{ code }}"
->normalizeKeys(false)
->variablePrototype()
->end()
->end()
->arrayNode('transformers')
->info('Transformers applied in sequence, by code, with their options')
->example(['explode' => ['delimiter' => '{{ separator }}']])
// Keep the dashes of the transformer codes (the former name of a generic transformer is deprecated)
->normalizeKeys(false)
->variablePrototype()
->end()
->end();
Expand Down
7 changes: 7 additions & 0 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ public function testTheDashesOfTheCodesAreKept(): void
self::assertSame(['to-upper'], array_keys($config['generic_transformers']));
self::assertSame(['demo.x-y'], array_keys($config['configurations']));
self::assertSame(['first-task', 'next-task'], array_keys($config['configurations']['demo.x-y']['tasks']));
// The transformers and the contextual options of a generic transformer, referenced by their code
$config = $this->process(['generic_transformers' => ['wrap' => [
'contextual_options' => ['wrap-format' => ['default' => '[%s]']],
'transformers' => ['to-upper' => null, 'sprintf' => ['format' => '{{ wrap-format }}']],
]]]);
self::assertSame(['wrap-format'], array_keys($config['generic_transformers']['wrap']['contextual_options']));
self::assertSame(['to-upper', 'sprintf'], array_keys($config['generic_transformers']['wrap']['transformers']));
// The keys of the options are still normalized
self::assertArrayHasKey('error_outputs', $this->process(['configurations' => ['p' => ['tasks' => [
't' => ['task' => 'transformer', 'error-outputs' => ['u']],
Expand Down
Loading