Problem/Motivation
In #2849827: Move workflow "settings" setters and getters to WorkflowTypeInterface many methods were deprecated as we moved a lot of functionality from the Workflow
config entity to the @WorkflowType
plugin. These methods can now be removed.
Proposed resolution
Delete the methods from the Workflow
config entity type and the WorkflowInterface
plugin interface, then update all uses of the method to call the @WorkflowType
plugin instead.
The deprecated methods are:
addState($state_id, $label)
hasState($state_id)
getStates($state_ids = NULL)
getState($state_id)
setStateLabel($state_id, $label)
setStateWeight($state_id, $weight)
deleteState($state_id)
getInitialState()
addTransition($id, $label, array $from_state_ids, $to_state_id)
getTransition($transition_id)
hasTransition($transition_id)
getTransitions(array $transition_ids = NULL)
getTransitionsForState($state_id, $direction = 'from')
getTransitionFromStateToState($from_state_id, $to_state_id)
hasTransitionFromStateToState($from_state_id, $to_state_id)
setTransitionLabel($transition_id, $label)
setTransitionWeight($transition_id, $weight)
setTransitionFromStates($transition_id, array $from_state_ids)
deleteTransition($transition_id)
Remaining tasks
None.
User interface changes
None.
API changes
Deprecated methods listed above are removed. Since the Workflows module is still experimental, and about to be marked beta-level stability, at which point its APIs will be frozen, this is the perfect (and last) time where we can do this. If we don't do this now, we'll be required to support this the entire Drupal 8 cycle.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#36 | 2893778-36.patch | 100.61 KB | Sam152 |
#36 | interdiff.txt | 2.06 KB | Sam152 |
#21 | 2893778-21.patch | 98.96 KB | Sam152 |
#9 | 2893778-9-combined.patch | 170.66 KB | timmillwood |
#9 | 2893778-9.patch | 99.2 KB | timmillwood |
Comments
Comment #2
plachNeeds to happen before 8.4.0
Comment #3
plachComment #4
timmillwoodWould've just uploaded to #2849827: Move workflow "settings" setters and getters to WorkflowTypeInterface but it's not working and didn't want to derail. So here's a patch (which is just an interdiff from the latest patch in the parent issue) and a combined patch of the two.
It is failing on
\Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testWorkflowDependencies
. When you delete a bundle which is assigned to a workflow, the whole workflow disappears, not sure why yet.Comment #5
timmillwoodIt seems to be something in the preDelete() method called when deleting the bundle which causes the workflow to disappear.
Comment #6
timmillwoodok, it's
\Drupal\Core\Config\Entity\ConfigEntityBase::preDelete
doing it, why is this doing it now, but not before?Comment #8
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI'm glad these were two different issues, reviewing another 100kb of code as part of the original issue would have been a huge headache.
Awesome work on this, confident we can fix the fails and get this in if the other issue is committed based on the progress already made.
Comment #9
timmillwoodI'd removed
onDependencyRemoval
from Workflow entity, when I shouldn't have.Thanks @Sam152 for the pointers via IRC.
Comment #10
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #11
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #12
Wim LeersIs this actually reviewable & RTBC'able, or blocked on another issue going in first?
Comment #13
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedIt's currently blocked on another issue.
Comment #14
tacituseu CreditAttribution: tacituseu commentedComment #15
plachPostponed on https://www.drupal.org/node/2849827
Comment #16
plachErr, I mean this
Comment #17
Wim LeersComment #18
Wim LeersIt'd be great to have an overview of what we're actually removing in the IS. If not for passing reviewers, then definitely for the committer who's undoubtedly going to say "WOW 100K PATCH!" :)
Comment #19
timmillwoodComment #20
larowlanComment #21
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commented#9 no longer applies.
Comment #22
timmillwoodLooks like we're good to go!
Comment #23
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedJust re-reviewed this as well. +1 RTBC.
Comment #24
Wim LeersComment #25
Wim LeersExplained why we want to do this now. Associated the https://www.drupal.org/node/2897706 change record with this issue too.
Comment #26
Wim LeersThis issue is not making big API changes. The big changes were made in #2849827: Move workflow "settings" setters and getters to WorkflowTypeInterface. This issue is merely following through on the changes that issue introduced, so that the Workflows module doesn't need to maintain support for lots of deprecated methods — method that were deprecated before the API was marked stable (which will happen when Workflows reaches "beta" level stability per https://www.drupal.org/core/experimental#beta — it is currently https://www.drupal.org/core/experimental#alpha).
This makes total sense.
99% of changes in this patch are trivial (the hard work was done in #2849827): most of it is just prefixing existing call chains with a
getTypePlugin()
call.RTBC +1
Comment #27
Wim LeersComment #28
timmillwoodThanks for the clarifications @Wim Leers, this patch could've easily been part of the previous issue, but at a combined size of 170kb, it seemed best to split.
Comment #29
Wim LeersYep, it totally makes sense :)
I'm just trying to look at this issue from a committer's POV, trying to criticize it from that POV, but as you can see, I can't find anything to criticize. Because the scope of #2849827 and the scope of this issue is so well-managed! 👏
Comment #31
Wim LeersRetesting, re-RTBC.
Comment #32
larowlanFail is valid, I triggered a retest after #2830740: Allow workflow types to lock certain changes to workflows once things are in use went in
Comment #33
larowlanFail was in HEAD, so may come back green, reverted the issue that caused the fail in HEAD
Comment #35
larowlanYep, needs reroll after #2830740: Allow workflow types to lock certain changes to workflows once things are in use
Comment #36
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #37
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #39
timmillwoodComment #41
Wim LeersComment #42
larowlanAdding WimLeers to issue credits for significant issue summary updates, change record association etc
Comment #45
larowlanCommitted as a16b9c7 and pushed to 8.5.x.
Cherry-picked as 031d03b and pushed to 8.4.x.
Triggering a re-test on #2896721: Remove the concept of decorated states/transitions from worfklow type plugins. and #2896725: Entirely remove the concept of WorkflowType(Interface|Base)::initializeWorkflow()
Comment #46
Wim LeersClarified impact of this issue in the CR at https://www.drupal.org/node/2897706/revisions/view/10586181/10586340.