Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add --with-guard to workflow:dump #60208

Open
@tacman

Description

@tacman

Description

The --with-metadata option in workflow dump is great. I'd also like to see the guard expressions.

Example

    #[Transition(
        from: [self::PLACE_NEW],
        to: self::PLACE_GEOCODED,
        guard: 'subject.getAddress()',
        metadata: ['description' => "geocode the address if it exists"]
    )]
    public const TRANSITION_GEOCODE = 'geocode';

Now:

Image

with guard:

Image

The guard: isn't necessary, unlike metadata which can be anything, we know what guard can be. So maybe simply style it? Adding a lock icon would be very cool.

Image

I can submit a PR, it's simply changing the .dot generation to something like:

digraph workflow {
  ratio="compress" rankdir="LR"
  node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="false" width="1"];
  edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"];

  place_c2a6b03f190dfb2b4aa91f8af8d477a9bc3401dc [label=<<B>new</B><BR/>description: starting point, after persisted>, shape=circle style="filled"];
  place_bdb684479baea5c9b311b4c3c7d2cb710180b8a6 [label=<<B>geocoded</B>>, shape=circle];
  place_c9560d94ee19830374678a9c9f9a0833801c9f62 [label=<<B>approved</B><BR/>description: this place is now visible on the map and app>, shape=circle];
  transition_b6589fc6ab0dc82cf12099d1c2d40ab994e8410c [label=<<B>geocode</B><BR/>description: geocode the address if it exists<BR/><I><U>subject.getAddress()</U></I>>, shape="box" regular="1"];
  transition_356a192b7913b04c54574d18c28d46e6395428ab [label=<<B>approve</B>>, shape="box" regular="1"];
  place_c2a6b03f190dfb2b4aa91f8af8d477a9bc3401dc -> transition_b6589fc6ab0dc82cf12099d1c2d40ab994e8410c [style="solid"];
  transition_b6589fc6ab0dc82cf12099d1c2d40ab994e8410c -> place_bdb684479baea5c9b311b4c3c7d2cb710180b8a6 [style="solid"];
  place_bdb684479baea5c9b311b4c3c7d2cb710180b8a6 -> transition_356a192b7913b04c54574d18c28d46e6395428ab [style="solid"];
  transition_356a192b7913b04c54574d18c28d46e6395428ab -> place_c9560d94ee19830374678a9c9f9a0833801c9f62 [style="solid"];
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions