Comments (4)
Hmmm, not quite sure. This looks like a carry-over from an earlier version of this package. Looks like the tricky part here is defining (via assoc. array in config) whether a transition should go from multiple places to one, or whether two different places can both transition to that place.
Do you have any suggestions on addressing that? Looks like the Symfony Transition class will handle an array $from
(lol at the misspelling in source). My first thought would be treating the "top" level of the 'from' array in the config as the "places" and allow arrays in it. So, your diagram example would be:
// ...
'transitions' => [
'publish' => [
'from' => [
['approved_by_journalist', 'approved_by_spellchecker']
]
'to' => 'published'
],
// ...
Which, looking at the code, that may already support that, though it's not documented anywhere?
from laravel-workflow.
Symfony really supports arrays in $from
, and, I believe, been doing so since early workflow component versions.
I have already applied the code I mentioned in first snippet. Instead of foreach:
$transitionObj = new Transition($transitionName, $transition['from'], $transition['to']);
$builder->addTransition($transitionObj);
if (isset($transition['metadata'])) {
$metadata['transitions']->attach($transitionObj, $transition['metadata']);
}
And the diagram looks this way:
'publish' => [
'from' => ['approved by journalist', 'approved by spellchecker'],
'to' => 'published'
],
Don't see any reason to add another level to 'from' and treat it any different from 'to'. Original YAML config is a plain array:
publish:
guard: "is_fully_authenticated()"
from:
- approved by journalist
- approved by spellchecker
to: published
from laravel-workflow.
Yes, that's right. The Transition class has supported arrays since at least 3.0, but I'm not sure the YAML has. I'll have to take a closer look into how Symfony handles it (that's the biggest divergence between this package and Symfony). The issue is how to differentiate between (a) either Place1 OR Place2 can transition to Place3 and (b) BOTH Place1 AND Place2 transition to Place3.
from laravel-workflow.
I'm going to close this for now, in favor of adding this into the documentation. There may be some possible routes to explore in the future with changing this behavior based on the workflow type (state machine or workflow), though I'm not quite sure how we could make the right assumptions to keep the config as is.
Please let me know if I'm misunderstanding anything here and we can reopen this.
from laravel-workflow.
Related Issues (20)
- Wrong argument type when calling GuardEvent HOT 17
- Event issuance triples HOT 3
- Marking_store configuration option should be removed HOT 2
- Wrong events fired when using transition from two places to one HOT 7
- workflow_apply second parameter HOT 2
- Dependency injection in listeners HOT 2
- $event->stopPropagation(); does not work HOT 5
- workflow:dump error if --path is not provided HOT 3
- [feature request] Trait method for saving current state Marking HOT 3
- Queued listeners fail HOT 4
- Event blocking in Guards stopped working HOT 9
- Wrong announce events HOT 10
- Install on L9 HOT 4
- Wrong announce events HOT 5
- Transition - From places definition HOT 16
- Upgrade to Laravel 10: got error getSubject() HOT 1
- Since symfony/workflow 6.4: The Symfony\Component\Workflow\Event\GuardEvent::getContext() method is deprecated and will be removed in 7.0 HOT 2
- Support for Laravel 11? HOT 5
- Events not working for me HOT 3
- Help to maintain this package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-workflow.