- Issue created by @timb
- πΊπΈUnited States tr Cascadia
The action is working.
The reason you see that error, "Update existing 'node' entity revision while changing the revision ID is not supported.", is because you have entity revisions enabled for that content type and you are trying to modify the existing revision "node" while you're in the process of creating a new revision.
It is a known issue that the UI does not prevent you from making mistakes like this, but even if the UI told you you couldn't do it you would still have to understand the core Drupal entity lifecycle in order to accomplish what you're trying to do.
Short answer is you need to choose an appropriate event at all times, but particularly in the case where you acting on a specific piece of content being modified and are then trying to modify that same specific content again during the update process.
In this case, the "After update" event corresponds to the core Drupal hook hook_entity_update()
The documentation for that hook says:Respond to updates to an entity.
This hook runs once the entity storage has been updated. Note that hook implementations may not alter the stored entity data.
(where I have added the emphasis).
So in your use case, I think a more appropriate event is "Before saving a content item", because the node *can* be altered before you enter the saving phase of the lifecycle.
- πΊπΈUnited States timb
Thank you @tr I will give it a try with the new event.
- πΊπΈUnited States timb
I reset the rule as suggested above as and have now encountered memory errors:
EVENT: Before saving a content item
ACTION: Publish a content item (Parameters: node: node)Page white screens with:
Fatal error: Allowed memory size of 268435456 bytes exhaustedIn the error logs:
Deprecated function: Return type of Drupal\rules\Engine\ActionExpressionContainer::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 13 of /code/web/modules/contrib/rules/src/Engine/ActionExpressionContainer.php)This also occurs with the other default Content actions such as Unpublish and Make selected content sticky.
This is both w/ and w/o revisions on the node.
This occurs in both the alpha and dev version of module.
- Status changed to Closed: works as designed
12 months ago 7:12pm 24 November 2023 - πΊπΈUnited States tr Cascadia
That error is because you are using PHP 8.1, and Rules was made compatible with PHP 8.1 years ago shortly after Drupal core was fixed for PHP 8.1. This tells me you're not using the current version of Rules.