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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timmillwood created an issue. See original summary.

plach’s picture

Status: Active » Postponed
Issue tags: +WI critical

Needs to happen before 8.4.0

plach’s picture

Priority: Normal » Major
timmillwood’s picture

Would'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.

timmillwood’s picture

It seems to be something in the preDelete() method called when deleting the bundle which causes the workflow to disappear.

timmillwood’s picture

ok, it's \Drupal\Core\Config\Entity\ConfigEntityBase::preDelete doing it, why is this doing it now, but not before?

Status: Needs review » Needs work

The last submitted patch, 4: 2893778-4-combined.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Sam152’s picture

I'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.

timmillwood’s picture

Status: Needs work » Needs review
FileSize
99.2 KB
170.66 KB

I'd removed onDependencyRemoval from Workflow entity, when I shouldn't have.

Thanks @Sam152 for the pointers via IRC.

Sam152’s picture

Issue tags: +workflows.module
Sam152’s picture

Component: content_moderation.module » workflows.module
Issue tags: -workflows.module
Wim Leers’s picture

Is this actually reviewable & RTBC'able, or blocked on another issue going in first?

Sam152’s picture

It's currently blocked on another issue.

tacituseu’s picture

Title: Removing deprecated Content Moderation methods » [PP-1] Removing deprecated Content Moderation methods
plach’s picture

Status: Needs review » Reviewed & tested by the community
plach’s picture

Status: Reviewed & tested by the community » Postponed

Err, I mean this

Wim Leers’s picture

Wim Leers’s picture

It'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!" :)

timmillwood’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update
larowlan’s picture

Title: [PP-1] Removing deprecated Content Moderation methods » Removing deprecated Content Moderation methods
Status: Postponed » Active
Sam152’s picture

Status: Active » Needs review
FileSize
98.96 KB

#9 no longer applies.

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

Looks like we're good to go!

Sam152’s picture

Just re-reviewed this as well. +1 RTBC.

Wim Leers’s picture

Issue summary: View changes
Wim Leers’s picture

Title: Removing deprecated Content Moderation methods » Remove deprecated Workflows methods
Issue summary: View changes

Explained why we want to do this now. Associated the https://www.drupal.org/node/2897706 change record with this issue too.

Wim Leers’s picture

This 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

Wim Leers’s picture

timmillwood’s picture

Thanks 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.

Wim Leers’s picture

Yep, 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! 👏

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 21: 2893778-21.patch, failed testing. View results

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

Retesting, re-RTBC.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
larowlan’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Fail was in HEAD, so may come back green, reverted the issue that caused the fail in HEAD

Status: Needs review » Needs work

The last submitted patch, 21: 2893778-21.patch, failed testing. View results

larowlan’s picture

Sam152’s picture

Status: Needs work » Needs review
FileSize
2.06 KB
100.61 KB
Sam152’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 36: 2893778-36.patch, failed testing. View results

timmillwood’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 36: 2893778-36.patch, failed testing. View results

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community
larowlan’s picture

Adding WimLeers to issue credits for significant issue summary updates, change record association etc

  • larowlan committed a16b9c7 on 8.5.x
    Issue #2893778 by timmillwood, Sam152, Wim Leers: Remove deprecated...

  • larowlan committed 031d03b on 8.4.x
    Issue #2893778 by timmillwood, Sam152, Wim Leers: Remove deprecated...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed
Wim Leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.