Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Steps to reproduce:
1. Enable moderation on articles.
2. Create an article in draft state.
3. Edit and publish it.
4. Delete it.
Expected: node is deleted and user is redirected to admin/content.
Actual: the following error happens: Fatal error: Call to a member function getRevisionId() on null in /var/www/drupal8/modules/contrib/workbench_moderation/src/ModerationInformation.php on line 167
Comment | File | Size | Author |
---|---|---|---|
#12 | deleting_a_moderated-2657914-12.patch | 2.26 KB | juampynr |
#8 | interdiff.txt | 1.83 KB | juampynr |
#8 | deleting_a_moderated-2657914-8.patch | 2.82 KB | juampynr |
#3 | deleting_a_moderated-2657914-2.patch | 2.36 KB | juampynr |
#2 | deleting_a_moderated-2657914-2-test-only.patch | 1.67 KB | juampynr |
Comments
Comment #2
juampynr CreditAttribution: juampynr at Lullabot commentedHere is a test that demonstrates it.
Comment #3
juampynr CreditAttribution: juampynr at Lullabot commentedAnd here is a patch that fixes it.
Comment #7
Crell CreditAttribution: Crell at Palantir.net for Acquia commentedAs discussed in IRC, let's move the check to bundleFormRedirect(). It seems cleaner there.
Comment #8
juampynr CreditAttribution: juampynr at Lullabot commentedHere it its.
Comment #9
Crell CreditAttribution: Crell at Palantir.net for Acquia commentedThis is a coding standards violation. The @inheritdoc is necessary.
There is always a latestRevisionId(), unless core has a bug. (And in some cases core does have a bug, which has its own issue somewhere.)
The fix we discussed belongs in the submit callback itself, not down here in the API call.
Comment #10
juampynr CreditAttribution: juampynr at Lullabot commentedDiscussed it with @Crell. We will take the chance to make hasForwardRevision() to return a boolean value.
Comment #11
juampynr CreditAttribution: juampynr at Lullabot commentedFrom IRC:
Comment #12
juampynr CreditAttribution: juampynr at Lullabot commentedI looked at the interface and saw that the error happens because getDefaultRevisionId() is not doing what the interface says: to return a NULL if there is no entity. I adjusted it and now the error is gone without touching anything else.
Comment #14
Crell CreditAttribution: Crell at Palantir.net for Acquia commentedInterfaces: Solving your problems since 2005. :-) Thanks, Juampy!