teewurst/pipeline-bundle

Symfony bundle for teewurst/pipeline

1.0.3 2022-04-28 10:38 UTC

This package is auto-updated.

Last update: 2024-04-28 14:51:09 UTC


README

Installation

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

Config without symfony/flex

Go to your config/bundles.php and add the following line

<?php

return [
    ...
    Teewurst\PipelineBundle\PipelineBundle::class => ['all' => true],
];

How to use

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:

Example teewurst/pipeline:^2

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

Example teewurst/pipeline:^3

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