Require the package and configure the bundle.
If you are using
symfony/flex
you don't have to do anything.
composer require teewurst/pipeline-bundle
Go to your config/bundles.php
and add the following line
<?php
return [
...
Teewurst\PipelineBundle\PipelineBundle::class => ['all' => true],
];
You are now able to use the pipeline service as factory for recursive and complex pipelines.
The example at teewurst\pipeline could be represented as:
My\App\MyPipeline:
factory: ['@teewurst\pipeline\PipelineService', create]
arguments:
# First Argument an array of <TaskInterface|array<TaskInterface|array<...>>>
$tasks:
- '@My\App\CheckServiceAvailabilityTask'
- - '@My\App\ErrorHandlerTask' # catch execution of submission even on error
- - '@My\App\PrepareDataTask'
- '@My\App\ValidateDataTask'
- '@My\App\DoGetOfferRequestTask'
# .. some additional things like set quote, upload documents etc.
- - '@My\App\LogResultLocalyTask'
- '@My\App\LogResultInDWTask'
# Symfony is not able to handle $options as obejct
# you need to write a factory itself
My\App\MyPipeline:
factory: ['@teewurst\pipeline\PipelineService', create]
arguments:
# First Argument an array of <TaskInterface|array<TaskInterface|array<...>>>
$tasks:
- '@My\App\CheckServiceAvailabilityTask'
- - '@My\App\ErrorHandlerTask' # catch execution of submission even on error
- - '@My\App\PrepareDataTask'
- '@My\App\ValidateDataTask'
- '@My\App\DoGetOfferRequestTask'
# .. some additional things like set quote, upload documents etc.
- - '@My\App\LogResultLocalyTask'
- '@My\App\LogResultInDWTask'
# Options array to pass pipeline
$classFqn: My\App\MyPipeline
$options: # only usable from Pipeline 3.0.0
- any
- options