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 @@ -2,6 +2,7 @@ Latest
------

## Changes
* [#311](https://github.com/cleverage/process-bundle/issues/311) Deprecate the `cleverage_process.event_listener.data_queue` service and `DataQueueEventListener` (it keeps a copy of the `ProcessState` of every `cleverage_process.data_queue` event in memory, without limit): injecting or fetching the service triggers a deprecation, they will be removed in v6.0. Write your own listener of the event dispatched by the `event_dispatcher` task. Update documentation, add tests.
* [#312](https://github.com/cleverage/process-bundle/issues/312) Add read-only interfaces for the process manager and the registries, implemented by the existing classes and autowired by their interface: `ProcessManagerInterface` (`execute()`), `ProcessConfigurationRegistryInterface` (`getProcessConfiguration()`, `getProcessConfigurations()`, `hasProcessConfiguration()`), `TransformerRegistryInterface` (`getTransformer()`, `getTransformers()`, `hasTransformer()`) and `TaskRegistryInterface` (`getTask()`). Type your services on them: the classes will be `final` in v6.0 (the services of the bundle will then be typed on the interfaces). Update documentation, add tests.
* [#310](https://github.com/cleverage/process-bundle/issues/310) Process configuration tree: a task `error_strategy` other than `skip` or `stop` is deprecated (notice when the container is compiled; it was accepted and the process failed with "Unknown error strategy" when the task failed), it will be rejected in v6.0. The process `public` key is a boolean node: a non-boolean value is rejected when the container is compiled, instead of a `TypeError` when the configuration is built. Describe the nodes of the process, task and generic transformer configurations (`config:dump-reference clever_age_process`). Update documentation, add tests.
* [#309](https://github.com/cleverage/process-bundle/issues/309) Composer: `ext-intl` is no longer required, it is suggested: it is only needed by the `slugify` transformer (`SlugifyTransformer`), which is replaced by a service failing with an explicit message when the extension is missing (`UnavailableServicesCompilerPass`). Update documentation, add tests.
Expand Down
4 changes: 4 additions & 0 deletions config/services/event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ services:
cleverage_process.event_listener.data_queue:
class: CleverAge\ProcessBundle\EventListener\DataQueueEventListener
public: false
deprecated:
package: cleverage/process-bundle
version: '5.4'
message: 'The "%service_id%" service is deprecated, it will be removed in v6.0: write your own listener of the event dispatched by the event_dispatcher task.'
tags:
- { name: kernel.event_listener, event: cleverage_process.data_queue, method: pushData }
5 changes: 5 additions & 0 deletions docs/reference/tasks/event_dispatcher_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function onDataQueue(EventDispatcherTaskEvent $event): void
`CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`. Every `EventDispatcherTask` without `event_name` then
triggers the same listeners.

**Deprecated since 5.4, removed in v6.0**: the bundle listens to the `cleverage_process.data_queue` event with the
`cleverage_process.event_listener.data_queue` service (`DataQueueEventListener`), which keeps a copy of the
`ProcessState` of every event in memory. Injecting or fetching this service triggers an `E_USER_DEPRECATED` error: write
your own listener, as above.

**Deprecated since v5, removed in v6.0**: from v4.0 to v5.0, the `event_name` option was ignored and the event was
always dispatched under its class name. To preserve backward compatibility, when `event_name` is set (and differs from the
event class name) and listeners subscribe to `CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`, the event is also
Expand Down
3 changes: 3 additions & 0 deletions src/EventListener/DataQueueEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* Used mostly for testing purpose.
*
* @internal
*
* @deprecated since cleverage/process-bundle 5.4, will be removed in 6.0: write your own listener of the event
* dispatched by the event_dispatcher task
*/
class DataQueueEventListener
{
Expand Down
14 changes: 14 additions & 0 deletions tests/DependencyInjection/CleverAgeProcessExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,18 @@ public function testTheProcessManagerIsResetBetweenExecutions(): void
$container->getDefinition('cleverage_process.manager.process')->getTag('kernel.reset')
);
}

public function testTheDataQueueListenerIsDeprecated(): void
{
$container = new ContainerBuilder();
(new CleverAgeProcessExtension())->load([], $container);

$id = 'cleverage_process.event_listener.data_queue';
$definition = $container->getDefinition($id);
self::assertTrue($definition->isDeprecated());
$deprecation = $definition->getDeprecation($id);
self::assertSame('cleverage/process-bundle', $deprecation['package']);
self::assertSame('5.4', $deprecation['version']);
self::assertStringStartsWith(\sprintf('The "%s" service is deprecated, it will be removed in v6.0', $id), $deprecation['message']);
}
}
Loading