Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Simplified Process With Symfony Workflow

BRUNO SOUZA
December 08, 2023

Simplified Process With Symfony Workflow

These slides were presented on Symfony Conference 2023, in Brussels.

BRUNO SOUZA

December 08, 2023
Tweet

More Decks by BRUNO SOUZA

Other Decks in Programming

Transcript

  1. Who Am I? I am Brazilian but living in Ireland

    I am a Symfony Lover ❤ You can find me at @Bruno_HSouza on Twitter Or @bruno7strings on Instagram
  2. AGENDA What Is a Process and Symfony Workflow? How to

    use Symfony Workflow? Workflow VS State Machine? The Real Case Scenario Generating Graphs Automatically
  3. What is a Process? A set of interrelated actions and

    activities performed to achieve a specified set of products, results, or services. A Guide to the Project Management Body of Knowledge (PMBOK® Guide). Project Management Institute, 2017
  4. 1 2 3 4 5 Enjoy The Talks Arriving in

    the event venue Get a Transport Get Out From Home How To Get To The Symfony Con 2023? The Steps Of The Going Process Select Your Room
  5. What is the Symfony Workflow? A workflow is a model

    of a process in the application
  6. What is the Symfony Workflow? A workflow is a model

    of a process in the application Consists of places and actions to get from one place to another
  7. What is the Symfony Workflow? A workflow is a model

    of a process in the application Consists of places and actions to get from one place to another Terminology definition: Place - step or stage in the process Transition - is the action of getting from one place to another Definition - set of places and transactions Marking - current state position Marking Store - a place to store the state
  8. Place Trans ition Place Trans ition Place Enjoy The Talks

    Select Your Room Arriving in the event venue Get a Transport Get Out From Home How To Get To The Symfony Con 2023? The Symfony Workflow Terminology
  9. Place Trans action Place Trans action Place Enjoy The Talks

    Select Your Room Arriving in the event venue Get a Transport Get Out From Home How To Get To The Symfony Con 2023? The Symfony Workflow Terminology Marking
  10. Place Trans action Place Trans action Place Enjoy The Talks

    Select Your Room Arriving in the event venue Get a Transport Get Out From Home How To Get To The Symfony Con 2023? The Symfony Workflow Terminology Definition
  11. How To Use The Symfony Workflow? How to install and

    configure the component in our applications
  12. Workflow VS State Machines Workflows can be in more than

    one place at the same time, the multiple-state terminology
  13. Workflow VS State Machines Workflows can be in more than

    one place at the same time, the multiple-state terminology The state machine uses the single-state terminology. The order can be only in a single place per time
  14. Workflow VS State Machines Workflows can be in more than

    one place at the same time, the multiple-state terminology The state machine uses the single-state terminology. The order can be only in a single place per time To apply a transition, workflows require that the object is in all the previous places of the transition
  15. Workflow VS State Machines Workflows can be in more than

    one place at the same time, the multiple-state terminology The state machine uses the single-state terminology. The order can be only in a single place per time To apply a transition, workflows require that the object is in all the previous places of the transition To apply a transition, state machines only require that the object is at least in one of those previous places
  16. The main difference is the way that Symfony Workflow stores

    the place data: Workflow: App\Entity\SalesOrder::getCurrentPlace(): ?array State Machine: App\Entity\SalesOrder::getCurrentPlace(): ?string The difference between workflow and state machine
  17. >= 22 valid status More than 7 applications involved More

    than 5 different scenarios 2 of the main applications are using Symfony Workflow Let’s talk about the entry application The sales order flow in the company
  18. 1 Sales Order Creation Request 2 Order Validation 3 Accepted

    4 Persist the Order 7 Complete 6 Processing 5 Send to the next application The Sales Order Flow The happy path for the order flow in the entry application
  19. DON’T TALK TO ME OR MY DOMAIN EVER AGAIN The

    DDD archicteture Evans, E. (2004) Domain-Driven Design. p. 70 DDD only really requires one isolated layer which is the Domain Layer. The "domain layer" is the manifestation of the domain model and all directly related design elements.
  20. It is possible to generate a visual representation of them

    as SVG or PNG images using: Graphviz, provides the dot command; Mermaid CLI, provides the mmdc command; PlantUML, provides the plantuml.jar file (which requires Java). Generating graphs
  21. From the Symfony 6.4 version, it is possible to use

    some metadata tags to style the workflow graphs: for places: bg_color: a color; description: a string that describes the state. for transitions: label: a string that replaces the name of the transition; color: a color; arrow_color: a color. Generating graphs - Stylish