The last remaining deprecation warning in Rules is:
- 4229x: Constructing a ContextDefinition object for an entity type is deprecated in Drupal 8.6.0. Use Drupal\Core\Plugin\Context\EntityContextDefinition instead. See https://www.drupal.org/node/2976400 for more information.
The
Drupal Core issue that is preventing us from fixing
Constructing a ContextDefinition object for an entity type is deprecated in Drupal 8.6.0. is
#3126747: ContextDefinition::create() can no longer be used with an entitytype-specific datatype (like entity:user) - getting that fixed in core is the last barrier to D9 compatibility.
Details may be found in the parent issue.
Here is a patch that is a pretty terrible solution, but at least it works.
@jonathan1055: Can you check the deprecations with this patch? It fixes them for me ...
Let me repeat, terrible solution, but if it allows us to be D9 compatible then we can add this as a hack to avoid the regression in core while we work on getting core fixed.
Comments
Comment #2
tr commentedComment #3
jonathan1055 commentedYes this works on the Travis builds at 8.8 and 8.9 and not a single deprecation message is produced. Here's a patch with adds a drupalci.yml file (not for committing) with
suppress-deprecations: falsejust to prove on d.o. that the messages are not produced.So how much more testing do we need to do woth this? I will use it for some manual testing, which I presume you have too. If we trust our automated tetss too, then it should be good for committing.
Comment #5
jonathan1055 commentedOK, so we have one PHPSTAN failure in #3. That implies that phpstan is not run by default on drupal.org, which is useful to know.
We should look at that separately.
Running again without PHPSTAN
Comment #7
jonathan1055 commentedOK now for the actual tests
Comment #8
jonathan1055 commentedThat's good. And what's even better is that I have run the tests on Travis at Core 9.0 and everything passes. Needed the obvious changes to composer.json and rules.info.yml plus one change to tests/src/Unit/Integration/RulesEntityIntegrationTestBase.php
This looks like legacy code no longer needed, and that file does not exist in D9. The tests also run at 8.8 and 8.9 without that line.
Anyway, that can be dealt with in a separate issue, to get Rules running at D9. For now, this looks OK to be committed. I'm really excited to be getting a D9 version of rules running, thank you TR for doing this work. Even if you say it yourself that it is a bad solution, it keeps us moving forward.
Comment #9
jonathan1055 commentedFor info, this is the Core issue which TR is having to work around
#3126747: ContextDefinition::create() can no longer be used with an entitytype-specific datatype (like entity:user)
Comment #10
tr commentedWell I can say that it's not easy to change ContextDefinition in any way and keep the tests passing - I must have tried a hundred different ways to fix this problem and none of them worked until this one. But yes, I think this can use some manual testing just to ensure that it doesn't affect things we don't explicitly test.
Please open an issue for #8.
The process for rolling out D9 compatibility is:
It seems that we'll only have #8 to fix for that last bullet point.
After these steps are taken, we will probably want to make a new release as well.
Comment #11
jonathan1055 commentedYes, you are right. Thanks for your persistence on this. I've been using it today, and, as you say, if the tests pass with this fairly major alteration, and we both agree that manual testing work, I say RTBC.
Comment #12
jonathan1055 commentedI have opened #3162246: Remove require_once includes/entity.inc which does not exist in D9 for the fix in #8
And that issue shows that this runs OK at D9.0
Comment #13
tr commentedI'm going to add a lot comments to this patch then commit it sometime this weekend so we can move forward with D9, as lack of a D9-compatible Rules version is blocking a lot of needed third-party integration.
Comment #14
tr commentedPatch with comments added.
Comment #16
tr commentedCommitted.
Comment #17
jonathan1055 commentedExcellent