- ๐ฎ๐ณIndia dev16.addweb
silvi.addweb โ made their first commit to this issueโs fork.
Hey there, encountering an issue with entity usage. Here are the two fatal errors we experience:
The two errors encountered were:
Call to a member function getRevisionId() on null
Call to undefined method
(I did not save the undefined method error output, so just capturing what I can recall here incase someone else reproduces it).
The issue as I am experiencing it is with a node that is revisionable, but does not have revisioning turned on. The original node is created programmatically in a behat step, and then we edit it via standard in browser behat testing steps. On save, we were getting both of the errors.
Adding the following sanity checks worked for me:
First, add an early exit if there is no original property.
// Exit immediately if no original. Somehow got to entity update unexpectedly.
if (!isset($entity->original)) {
return;
}
...and second, just sanity check both objects have the required methods. RevisionableInterface should require it, but... I'm not experiencing that.
foreach ($fields as $field_name) {
if (($source_entity instanceof RevisionableInterface) &&
method_exists($source_entity, 'getRevisionId') &&
method_exists($source_entity->original, 'getRevisionId') &&
$source_entity->getRevisionId() != $source_entity->original->getRevisionId() &&
...
Active
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
silvi.addweb โ made their first commit to this issueโs fork.