-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Workflow, document (best?) practices #9834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @atrauzzi, if you need a full control when writing and reading a state in your model, you should then use a custom You would then need to replace the configuration by the following: framework:
workflows:
some_entity_name:
type: 'workflow'
marking_store:
service: App\Workflow\SomeEntityMarkingStore |
@HeahDude - I don't mind using the current marking store and reading the array it provides, is there any reason I would want to use my own beyond that? (Also, just to note: I'm not using this as part of a symfony project, so the YAML configs aren't really an option for me.) |
Yes, this separates concerns, so it follows best practices. |
Hi. About this transition: new Transition(AddonSubscriptionTransition::INSTALL_FREE,
[AddonSubscriptionState::INACTIVE, AddonSubscriptionState::FREE, AddonSubscriptionState::TRIAL_UNAVAILABLE],
[AddonSubscriptionState::ACTIVE]), Do you know you object should be in all three places ( About the Custom Marking Store: Indeed it will be cleaner to use it. But you don't have to. But still ;) Side node: You should never alter the state of your object directly. So be careful when you modify some information in your entity. Finally, I don't have access to your code, but it looks like there is something strange here. Usually, you should not care about call to |
So that leaves the "strange" part. Unfortunately, the state I'm wanting to check on isn't summarized in any way. I'm feeding data into the state machine that comes from |
Hi @atrauzzi Is this issue still pending? |
I'd say so, yeah. I think only half the story is presented in the current documentation. Effective, practical usage of workflow is not quite ev 8000 ident and all we're really shown currently are the core types. |
Can you name some „headlines“ you would want to read? This could maybe help us to get into the right direction and split this issue in smaller pull requests |
@atrauzzi do you mean you need/want more « real userland » code using workflow component inside the documentation? Or you want to use it in a special way and you miss some docs? Also you can read the code doc classes or interfaces sometimes it helps |
More userland 🙂 |
it is maybe more some blog posts (symfony or other dev teams) then, to see more use cases of this component i think not it should be inside the doc |
Hmm, I think the docs are still the right place. The first spot I looked for examples are here. I really think there needs to be something to help people get started. Some kind of guidance. It's way too vague to just be given this base class and no idea of its lifecycle as it relates to one's own application. I'm not asking for solutions on specific domain, but the nature by which specific domain code interacts with this component. |
At first, and much to my frustration, I thought the documentation for Workflow was extremely inadequate.
The latter is much more detailed. I really think they should be merged or, at least, have prominent links to one another. |
👍 I already reported that to the doc team. It's really hard to find all pages. Would you mind creating a PR @milosa ? |
…led doc (noniagriconomie) This PR was merged into the 3.4 branch. Discussion ---------- [Workflow] Add workflow documentation link to more detailed doc Hi Here is an attempt to better link the Workflow component bare + component with Symfony documentations FYI the https://symfony.com/doc/master/workflow.html reference a "read more" page on the first paragraph But as all components pages looks the same, I put this at the bottom of the page not on top Related to #9834 (comment) friendly ping @lyrixx Commits ------- 4b1e7db Update workflow.rst
I'm closing this old issue because we've made many changes in the Workflow component docs since the issue was opened. Thanks. |
But did they address anything? |
Uh oh!
There was an error while loading. Please reload this page.
I've crawled over the ~4 pages of documentation on workflow from the symfony site which have been enough to get me to this point.
Unfortunately, the documentation I link to above focuses strictly on bootstrapping the component. There isn't as much as I'd like to see about any of the ways it its outputs can be used. I'm opening this ticket because while functionally I'm getting the output I desire, I'm in the phase now where I like to reflect on my usage of a new component and inquire about best practices.
I think my most specific thoughts/questions/facts are:
MultipleStateMarkingStore
implementationgetState
method, I'm currently assembling the statearray
based on various bits of information I infer from my domain graph.array
because some states/places originate from outside my subject (related models).places
, to a singleplace
. This is because I only care about the one value and will regenerate the others from my domain ingetState
during future checks:setState
on my model, I'm only going to interpret the value to determine what data I need to write to the database.setState
call. But should I not be doing that and specifically focusing on using the events API of workflow to act on my data?So, generally speaking, I'm looking for some anti-pattern advice, but I think some of this might do well to be codified somehow in the documentation so that people aren't inadvertently subverting the intended design of this very useful component!
I might update this description if I dream up better ways of explaining things, I hope you get the gist of what I'm after. 😄
The text was updated successfully, but these errors were encountered: