Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
This issue still exists. If we enable content moderation for a content type we are unable to import content moderation.
We are getting the following error
Error: Call to undefined method stdClass::save() in Drupal\content_moderation\Entity\ContentModerationState->save() (line 181 of /var/www/html/sharaf-dg-drupal/core/modules/content_moderation/src/Entity/ContentModerationState.php) #0 /var/www/html/sharaf-dg-drupal/modules/contrib/content_sync/src/Importer/ContentImporter.php(170): Drupal\content_moderation\Entity\ContentModerationState->save()
Notes:
I did some troubleshooting.
- content moderation YML has hard ‘references’ to the entity and the revision. They are considered integer fields, it is why they don’t get changed to the UUID and Type format. [possible solution: normalize/denormalize the entity/fields for import/export]
- The tricky part will be to handle the revisions, I have to double check but I think entity revisions are never exported/imported.. I believe Revisions are skipped because when saving an entity in the target site a revision is added by default.. So:
Should entity revisions be exported/imported or skipped? If skipped, exporting/importing content moderation states won’t make sense.
Comments
Comment #2
simoneb commentedAny news on this one? still happening
Comment #3
kentr commentedMight be related (similar) to #2881718: undefined method stdClass::save() in install with content moderation.
Comment #4
ramuchidambaram commentedThis issue still exists. If we enable content moderation for a content type we are unable to import content moderation.
We are getting the following error
Error: Call to undefined method stdClass::save() in Drupal\content_moderation\Entity\ContentModerationState->save() (line 181 of /var/www/html/sharaf-dg-drupal/core/modules/content_moderation/src/Entity/ContentModerationState.php) #0 /var/www/html/sharaf-dg-drupal/modules/contrib/content_sync/src/Importer/ContentImporter.php(170): Drupal\content_moderation\Entity\ContentModerationState->save()
Comment #5
blanca.esqueda commentedNotes:
I did some troubleshooting.
- content moderation YML has hard ‘references’ to the entity and the revision. They are considered integer fields, it is why they don’t get changed to the UUID and Type format. [possible solution: normalize/denormalize the entity/fields for import/export]
- The tricky part will be to handle the revisions, I have to double check but I think entity revisions are never exported/imported.. I believe Revisions are skipped because when saving an entity in the target site a revision is added by default.. So:
Should entity revisions be exported/imported or skipped? If skipped, exporting/importing content moderation states won’t make sense.
Comment #6
blanca.esqueda commented