Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Documented the workflow metadata#9476

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
javiereguiluz wants to merge1 commit intosymfony:4.1fromjaviereguiluz:fix_9475

Conversation

@javiereguiluz
Copy link
Member

Thisfixes#9475 but it's missing an example. Maybe@lyrixx can help us here. Thanks!

@javiereguiluz
Copy link
MemberAuthor

@lyrixx we'll need your review/help to finish this PR (hopefully before 4.1 is released in one month). Thank you!

@lyrixx
Copy link
Member

OK, I will look at it ASAP

Copy link
Member

@lyrixxlyrixx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Here we go ;)

I have also done that:https://github.com/lyrixx/SFLive-Paris2016-Workflow/pull/8/files

If you need more help, just ping me ;)

Then, you can access this metadata in your PHP code as follows::

// MISSING EXAMPLE HERE...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You can access it in different ways.

If you are using the workflow directly:

// I executed this code in the controller, so basically I'm fetching a Workflow instance$workflow =$this->get('workflow.article');$workflow            ->getMetadataStore()            ->getWorkflowMetadata()['title'] ??false        ;$workflow            ->getMetadataStore()            ->getPlaceMetadata('draft')['title'] ??false        ;$aTransition =$workflow->getDefinition()->getTransitions()[0];$workflow            ->getMetadataStore()            ->getTransitionMetadata($aTransition)['title'] ??false        ;// There is a shortcut that work with everything, see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Workflow/Metadata/MetadataStoreInterface.php#L34-L36$workflow            ->getMetadataStore()            ->getMetadata('title')        ;

Use case: Flash message:

// $transition = ...; (an instance of Transition)$title =$this->get('workflow.article')->getMetadataStore()->getMetadata('title',$transition);$request->getSession()->getFlashBag()->add('info',"You have successfully applied the transition with title: '$title'");

In a listener:

<?phpnamespaceApp\Listener\Workflow\Task;useSymfony\Component\EventDispatcher\EventSubscriberInterface;useSymfony\Component\Workflow\Event\GuardEvent;useSymfony\Component\Workflow\TransitionBlocker;class DoneGuardimplements EventSubscriberInterface{publicfunctionguardPublish(GuardEvent$event)    {$timeLimit =$event->getMetadata('time_limit',$event->getTransition());if (date('Hi') <=$timeLimit) {return;        }$explanation =$event->getMetadata('explaination',$event->getTransition());$event->addTransitionBlocker(newTransitionBlocker($explanation ,0));    }publicstaticfunctiongetSubscribedEvents()    {return ['workflow.task.guard.done' =>'guardPublish',        ];    }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nice snippets :)

alexislefebvre reacted with thumbs up emoji
{% for transition in workflow_transitions(article) %}
<li>
{{ transition.name }}:
<code>{{ workflow_metadata(article, 'priority', transition) ?: '0' }}</code>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Super example !!!

@xabbuhxabbuh changed the base branch frommaster to4.1May 8, 2018 08:40
@alexislefebvre
Copy link
Contributor

Is this PR ready? Can someone please merge it? Can we help in any way?

@lyrixx
Copy link
Member

Is this PR ready? Can someone please merge it? Can we help in any way?

No, There is still a "MISSING EXAMPLE HERE".
If you want you can finish it ❤️

@alexislefebvre
Copy link
Contributor

Ok, I'm sorry I thought thatyour comment filled this gap.

// ...
'places' => array(
'draft' => array(
'max_num_of_words' => 500,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

missing metadata array or i miss something?@javiereguiluz

alexislefebvre and lyrixx reacted with thumbs up emoji
fabpot added a commit to symfony/symfony that referenced this pull requestMar 19, 2019
This PR was squashed before being merged into the 4.3-dev branch (closes#29538).Discussion----------[Workflow] Add colors to workflow dumpsFixes#28874| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#28874, replaces#28933| License       | MIT| Doc PR        | TODO, requiressymfony/symfony-docs#9476Fetch data with the `MetadataStore` from#26092 in order to add colors to the dumps.Example of configuration:```yaml            transitions:                submit:                    from: start                    to: travis                    metadata:                        title: transition submit title                        dump_style:                            label: 'My custom label'                            arrow_color: '#0088FF'                            label_color: 'Red'```This code was developed as a bundle, examples can be found on its repository:https://github.com/alexislefebvre/SymfonyWorkflowStyleBundleCommits-------60ad109 [Workflow] Add colors to workflow dumps
pbowyer added a commit to pbowyer/symfony-docs that referenced this pull requestMar 23, 2019
pbowyer added a commit to pbowyer/symfony-docs that referenced this pull requestMar 23, 2019
@javiereguiluz
Copy link
MemberAuthor

Closing this in favor of the new PRs created by@pbowyer. Thanks Peter!

pbowyer added a commit to pbowyer/symfony-docs that referenced this pull requestApr 7, 2019
pbowyer added a commit to pbowyer/symfony-docs that referenced this pull requestApr 7, 2019
javiereguiluz added a commit that referenced this pull requestApr 17, 2019
… pbowyer, OskarStark)This PR was merged into the 4.2 branch.Discussion----------Documented the workflow metadata [redux]With@javiereguiluz's permission I have taken#9476 and incorporated the comments and code examples into it.This is the start of a push to improve the Workflow documentation. The focus now is on expanding the documentation by merging pull requests; organizing it will come later.Commits-------7f3a0fd Oskar's feedbacka4c23c1 Add blank line between code block and sentence above. Code block was not rendering.6080aa8 Remove the word 'simple'3765ddb Change code formatting of PHP snippet perhttps://github.com/symfony/symfony-docs/pull/11209/files/d57fa38d903175d58d9cfbf63f20e7ced8d2fd01#r26839165555c9199 Indent PHP block by an additional 4 spaces225c2fe Apply suggestions from code reviewf716e81 Incorporate@OskarStark's feedback94d17de Simplify the English and turn it into a tip40fbaf3 Update arrays to use short syntaxea64992 Incorporate further excellent feedback from@HeahDudeaf71c14 Add an introduction as suggested in#11209 (comment)ca66356 Document how to see all configuration options (see#11209 (comment))c9ef262 Incorporate@OskarStark's feedbackc595c47 First set of tidy-ups for@HeahDude's feedback.663639b Incorporate the code examples in#9476 (comment) into the documentation17eae8c Add missing metadata key, fixing comment by@noniagriconomie on#9476d68cc99 Documented the workflow metadata
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

3 more reviewers

@lyrixxlyrixxlyrixx left review comments

@noniagriconomienoniagriconomienoniagriconomie left review comments

@ndenchndenchndench approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

7 participants

@javiereguiluz@lyrixx@alexislefebvre@ndench@noniagriconomie@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp