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

[Workflow] Added a context toWorkflow::apply()#29146

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

Merged
lyrixx merged 1 commit intosymfony:masterfromlyrixx:workflow-context
Mar 6, 2019

Conversation

@lyrixx
Copy link
Member

@lyrixxlyrixx commentedNov 8, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#27925 (maybe#28253 and#28266)
LicenseMIT
Doc PR

jhaoda, noniagriconomie, deguif, and maidmaid reacted with thumbs up emojijhaoda and jeremyFreeAgent reacted with heart emoji
@lyrixx
Copy link
MemberAuthor

I thought it will be easy, but the Property Access does not support passing 2 arguments to a setter (super logic after all).

I don't know how to achieve this. Some randome ideas

  1. Pass aPlaceAndContext to the POPO. but the BC layer will be impossible
  2. do not rely on the thePropertyAccess anymore (but this imply re-code a (small) part of it in the workflow)
  3. Add aMarkingStoreWithContext that does not rely onProperyAccess and support onlysetXXXX method call (or with an Interface)
  4. use thePropertyAccess to callsetMarking thensetContext

Have you other ideas ? What do you prefer ?

Actually I prefer the 2/
It quite easy. we only need to check if a property if public or if methodmarking() exist, orsetMarking() exist. We could still use thePropertyAccessor forgetMarking.

@stof
Copy link
Member

stof commentedNov 8, 2018

@lyrixx I think you are forgetting the fact that PropertyAccess takes a property path as input, not just a property name. Using PropertyAccess to read but a simpler implementation supporting only property names to write will not work.

@lyrixx
Copy link
MemberAuthor

Ah you are right. So we should go to 3/

What do you think ?

@lyrixx
Copy link
MemberAuthor

Just one question, as we do not mention we are using the Property Path component, is it a BC break a change the implementation ?

@nicolas-grekasnicolas-grekas added this to thenext milestoneNov 8, 2018
@nicolas-grekas
Copy link
Member

Not if nothing changes on the outside surface.What would be the user visible side effect?

@lyrixx
Copy link
MemberAuthor

lyrixx commentedNov 8, 2018
edited
Loading

@nicolas-grekas It could change someting to the end user if they use this kind of configuration:

framework:workflows:my_workflow:marking_store:type:multiple_statearguments:                     -'property1.property2'
  1. thearguments is documented there :https://symfony.com/doc/current/workflow/usage.html#creating-a-workflow
  2. We don't explain thatproperty1.property2 is supported.

So, if no one is using this feature (we can not be sure, I know, but really I doubt someone is using it), there are no difference for the end user

@lyrixx
Copy link
MemberAuthor

I case of you think it's a BC break, what do you think if the last commit?

@noniagriconomie
Copy link
Contributor

@lyrixx thank you on coding this 👍

just a question: what is the aim behindMethodSingleStateMarkingStore? not sure to understand (i mainly use this component with single state)

also, how can we deal with sort of "validation" of the context?
optionresolver? interface? i think it could be safer to have this kind of control

@lyrixx
Copy link
MemberAuthor

The aim ofMethodSingleStateMarkingStore is to be able to call$subject->setMarking($place, $context).

also, how can we deal with sort of "validation" of the context?

We will not validate the context. It's not the role of the workflow component to do that.

@noniagriconomie
Copy link
Contributor

fair enough :) 👍

@lyrixx
Copy link
MemberAuthor

Here we go. I think this PR is ready.

Here is the diff the developer will have to do to use this new feature:
lyrixx/SFLive-Paris2016-Workflow#21

Copy link
Contributor

@noniagriconomienoniagriconomie left a comment

Choose a reason for hiding this comment

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

thank you for the feature

Copy link
Contributor

@noniagriconomienoniagriconomie left a comment

Choose a reason for hiding this comment

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

hope this feature will be merged and documented soon :)

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM thanks. Here are some comments (+rebase needed)

@lyrixx
Copy link
MemberAuthor

Note: I lost the integration with the framework bundle. I will fix it asap

@lyrixxlyrixxforce-pushed theworkflow-context branch 2 times, most recently fromcdd911d tob2cbe22CompareDecember 4, 2018 17:26
@lyrixx
Copy link
MemberAuthor

lyrixx commentedDec 4, 2018
edited
Loading

Hi!

I finished this PR

But (in another PR) I would like to:

  • deprecateSingleStateMarkingStore andMultipleStateMarkingStore. The newMethodMarkingStore could replace them for most a use case. If people are doing very complex thing, I would suggest using a service for that. We already have all infrastructure for it. My motivation are simplicity and expliciteness. the semantic configuration will me more explicit (instead ofarguments: [true, marking] will could havearguments: {single_state: true, property: marking}). Thus I will be able to delete some code ❤️

  • I don't really understand why we have theValidateWorkflowsPass. It adds some complexity and I don't really see the use case here.@Nyholm Why did you added it ? We could directly validate the definition in the Framework Extension

What do you think ?

@lyrixxlyrixx merged commit7d5b7a3 intosymfony:masterMar 6, 2019
@lyrixx
Copy link
MemberAuthor

@noniagriconomie here we go. I rebased the PR and merged it. You can now test it and give me feedback. Thanks

@lyrixxlyrixx deleted the workflow-context branchMarch 6, 2019 18:32
lyrixx added a commit that referenced this pull requestMar 6, 2019
…ixx)This PR was merged into the 4.3-dev branch.Discussion----------[Workflow] Added a context to `Workflow::apply()`| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#27925 (maybe#28253 and#28266)| License       | MIT| Doc PR        |Commits-------7d5b7a3 [Workflow] Added a context to `Workflow::apply()`
@lyrixx
Copy link
MemberAuthor

lyrixx commentedMar 6, 2019
edited
Loading

an usage example base onhttps://github.com/lyrixx/SFLive-Paris2016-Workflow
(I will update the demo asap)

/**     * @Route("/apply-transition/{id}", methods={"POST"}, name="article_apply_transition")     */publicfunctionapplyTransitionAction(Request$request,Article$article)    {try {$this->get('workflow.article')                ->apply($article,$request->request->get('transition'), ['time' =>time()]);$this->get('doctrine')->getManager()->flush();        }catch (ExceptionInterface$e) {$this->get('session')->getFlashBag()->add('danger',$e->getMessage());        }return$this->redirect($this->generateUrl('article_show', ['id' =>$article->getId()])        );    }

and theArticle::setMarkingMethod:

publicfunctionsetMarking($marking,array$context = [])    {$this->marking =$marking;dump($context);    }

@lyrixx
Copy link
MemberAuthor

lyrixx commentedMar 6, 2019
edited
Loading

Here we go:How to use it and thedemo

@noniagriconomie
Copy link
Contributor

noniagriconomie commentedMar 6, 2019
edited
Loading

@lyrixx many thanks :)

Will of course test it and use it asap

Edit :
http://symfony-workflow-demo.herokuapp.com/task/show/1263 is broken (wanted to test on state machine also)

Also, can you have a second look at
symfony/symfony-docs#10751 ?

Thank you

@nicolas-grekas
Copy link
Member

Caught :)
See#30524

symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestMar 13, 2019
…rameworkExtension (lyrixx)This PR was merged into the 4.3-dev branch.Discussion----------[Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |---Just some cleaning. Seesymfony/symfony#29146 (comment)Commits-------a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
symfony-splitter pushed a commit to symfony/workflow that referenced this pull requestMar 13, 2019
…rameworkExtension (lyrixx)This PR was merged into the 4.3-dev branch.Discussion----------[Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |---Just some cleaning. Seesymfony/symfony#29146 (comment)Commits-------a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
lyrixx added a commit that referenced this pull requestMar 13, 2019
…rameworkExtension (lyrixx)This PR was merged into the 4.3-dev branch.Discussion----------[Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |---Just some cleaning. See#29146 (comment)Commits-------a608797 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
@vudaltsov
Copy link
Contributor

@lyrixx , why not makingMethodMarkingStore final? I think, we should not encourage extending it, WDYT? On my practice, whenever I wanted to store markings differently, I always wrote a new implementation.

@lyrixx
Copy link
MemberAuthor

@vudaltsov Good idea 👍 I will do that :)

@vudaltsov
Copy link
Contributor

@lyrixx , I can do a PR for you, if you wish, have some time now!

@lyrixx
Copy link
MemberAuthor

oh yes. Please do :)

symfony-splitter pushed a commit to symfony/workflow that referenced this pull requestMar 22, 2019
This PR was merged into the 4.3-dev branch.Discussion----------Make MethodMarkingStore final| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | n/a| License       | MIT| Doc PR        | n/aMade `MethodMarkingStore` final as proposed insymfony/symfony#29146 (comment).Commits-------bbf582bce5 Make MethodMarkingStore final
lyrixx added a commit that referenced this pull requestMar 22, 2019
This PR was merged into the 4.3-dev branch.Discussion----------Make MethodMarkingStore final| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | n/a| License       | MIT| Doc PR        | n/aMade `MethodMarkingStore` final as proposed in#29146 (comment).Commits-------bbf582b Make MethodMarkingStore final
@lyrixx
Copy link
MemberAuthor

@noniagriconomie The demo has been fixed. Thanks for hint.

noniagriconomie reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

+1 more reviewer

@noniagriconomienoniagriconomienoniagriconomie left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

10 participants

@lyrixx@stof@nicolas-grekas@noniagriconomie@Nyholm@jhaoda@vudaltsov@fabpot@michaelcullum@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp