-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Workflow] Remove unnecessary method calls #21784
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
getEnabledTransitions() method only requires 1 parameter "$subject". Removed instances where a second $this->getMarking($subject) is being passed to getEnabledTransitions().
Looks like you opened your PR against the wrong branch or forgot to rebase it. |
MarkingStore->setMarking() is being called on every call to getMarking() in the Workflow class. This is only required if a new Marking is initialised and set as per line 63: `$marking->mark($this->definition->getInitialPlace());` If the Marking is not new, the subject either already has a marking and we don't need to call setMarking(), or it is new && theres no `initial place`. In that case an Exception is thrown on line 61.
ping @lyrixx |
Comply with Coding Standard.
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.
👍 expect a little comment.
@@ -61,6 +61,9 @@ public function getMarking($subject) | |||
throw new LogicException(sprintf('The Marking is empty and there is no initial place for workflow "%s".', $this->name)); | |||
} | |||
$marking->mark($this->definition->getInitialPlace()); | |||
|
|||
// Because the marking could have been initialized, we update the subject |
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.
I would remove this comment because now, it's clear the marking has been updated.
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.
comment updated in 7edad79.
👍 |
Q: how often do you release patches? Is there a specific timeline for v3.2.5? (new to symfony dev cycle, couldn't find this detailed anywhere..) |
@izzyp we do patch releases once a month (except when a security issue requires us to release an extra one faster) |
Thank you @izzyp. |
This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #21784). Discussion ---------- [Workflow] Remove unnecessary method calls | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | License | MIT getEnabledTransitions() method only requires 1 parameter "$subject". Removed places where a second parameter "$this->getMarking($subject)" is being passed to getEnabledTransitions(). <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Commits ------- 12d9129 [Workflow] Remove unnecessary method calls
getEnabledTransitions() method only requires 1 parameter "$subject".
Removed places where a second parameter "$this->getMarking($subject)" is being passed to getEnabledTransitions().