-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Workflow] Added a context to Workflow::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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lyrixx
commented
Nov 8, 2018
•
edited
Loading
edited
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 |
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
Have you other ideas ? What do you prefer ? Actually I prefer the 2/ |
@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. |
Ah you are right. So we should go to 3/ What do you think ? |
Just one question, as we do not mention we are using the Property Path component, is it a BC break a change the implementation ? |
Not if nothing changes on the outside surface.What would be the user visible side effect? |
@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_state
arguments:
- 'property1.property2'
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 |
I case of you think it's a BC break, what do you think if the last commit? |
@lyrixx thank you on coding this 👍 just a question: what is the aim behind also, how can we deal with sort of "validation" of the context? |
The aim of
We will not validate the context. It's not the role of the workflow component to do that. |
fair enough :) 👍 |
6f8e66c
to
e6ff774
Compare
Here we go. I think this PR is ready. Here is the diff the developer will have to do to use this new feature: |
15d04c1
to
ade6666
Compare
ade6666
to
858bf31
Compare
There was a problem hiding this 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
src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 :)
src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php
Outdated
Show resolved
Hide resolved
8f727cc
to
58a3f8e
Compare
There was a problem hiding this 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)
Note: I lost the integration with the framework bundle. I will fix it asap |
cdd911d
to
b2cbe22
Compare
Hi! I finished this PR But (in another PR) I would like to:
What do you think ? |
@noniagriconomie here we go. I rebased the PR and merged it. You can now test it and give me feedback. Thanks |
…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()`
an usage example base on https://github.com/lyrixx/SFLive-Paris2016-Workflow /**
* @Route("/apply-transition/{id}", methods={"POST"}, name="article_apply_transition")
*/
public function applyTransitionAction(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 the public function setMarking($marking, array $context = [])
{
$this->marking = $marking;
dump($context);
} |
Here we go: How to use it and the demo |
@lyrixx many thanks :) Will of course test it and use it asap Edit : Also, can you have a second look at Thank you |
Caught :) |
…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 symfony/symfony#29146 (comment) Commits ------- a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
…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 symfony/symfony#29146 (comment) Commits ------- a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
…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
@lyrixx , why not making |
@vudaltsov Good idea 👍 I will do that :) |
@lyrixx , I can do a PR for you, if you wish, have some time now! |
oh yes. Please do :) |
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/a Made `MethodMarkingStore` final as proposed in symfony/symfony#29146 (comment). Commits ------- bbf582bce5 Make MethodMarkingStore final
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/a Made `MethodMarkingStore` final as proposed in #29146 (comment). Commits ------- bbf582b Make MethodMarkingStore final
@noniagriconomie The demo has been fixed. Thanks for hint. |