A
A
Alexander Evgenievich2016-12-14 11:55:02
symfony
Alexander Evgenievich, 2016-12-14 11:55:02

What and why "Symfony Workflow Component"?

Здравствуйте !
Вот в дайджесте по PHP в комментариях проскочила информация о Symfony Workflow компоненте. В описании компонента довольно мало информации, чтобы человеку, впервые сталкивающемуся с таким понятием, понять что же это такое. В комментариях на хабре было еще прикреплено видео с докладом о Sf Workflow, однако из доклада я ничего не понял, кроме красивых выражений о графах, абстракциях и таких же примерах, в принципе ничего и не вынес.
Вопрос: как и зачем это [Workflow] в общем, и [SF Workflow Component] в частности, нужно применять ? Прошу тех, кто знаком с данной темой, помочь обьяснениями.
Заранее спасибо !

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Юрий, 2016-12-14
@banderos120

learned about the component from your question, quite interesting.
adds a state machine to symphony. it will be convenient when entities have certain states, for example, a task and its states (open, running, verification required, closed, etc.). this component adds the ability to register in the config all states and possible transitions between them, that is, from which to which you can go. the same will be useful for example for the status of orders in the store, acceptance for publication of an article.
Also, the component allows you to hang up your own handlers for changing statuses (through a common event manager). and adds convenient helper functions to the twig to check the current statuses and the possibility of changing them. in the article, for example, a case is shown - display buttons for changing the statuses of the article, only those buttons for changing statuses are displayed, the transition to which is allowed in the config. Previously it had to be done by hand.
Looking through the test application example, I realized that the statuses are stored in the marking field of the https://github.com/lyrixx/SFLive-Paris2016-Workflo... entity,
the field has the json_array type. it would be necessary to launch this test project, to drive. for example, it is not yet obvious to me how to filter entities by this status, is it possible to add a separate field/I and change it in subscribers.
you can also look through the sources of the bundle itself, for example, here is a method for changing the status https://github.com/symfony/workflow/blob/master/Wo...

V
Vladimir Chernyshev, 2016-12-22
@VolCh

I'll add to Yuri 's answer :
One of the main goodies of Workflow in such components / frameworks / systems is the inversion of control over entities and other models. The client does not change the status of an entity through the conditional setStatus('approved') setter with additional side effects, but performs the transition (action, process) apply('approve'), one of the side effects of which is a status change. It seems that the difference is insignificant from a technical point of view, but business customers usually operate with processes in which entities are involved, and not with the operations of the entities themselves, they say "as a result of signing the contract, it is assigned the status "active"" and not "assigning the status to the contract" active" means that the contract has been signed". When their demand changes to "

D
dizzy7, 2016-12-14
@dizzy7

In such cases, a simple rule usually applies - if you don’t understand why you need it, then you don’t need it =) The video explains in great detail and clearly where it can be applied, if you don’t understand, then you simply didn’t have such tasks.
Once upon a time, for example, I had the task of processing applications. About seven statuses with complex conditions and the ability to move from status to status - this is just a case for workflow.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question