Trying to rebuild sitemap with xmlsitemap module with content_moderation core module in use we get error when executing batch:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: http://solar.com/batch?id=38&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: {"message":"A fatal error occurred: Field changed is unknown."}

"Recent log messages" logs this:
InvalidArgumentException: Field changed is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 471 of /vagrant/drupal/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Same thing was reported in https://www.drupal.org/node/2747373

I will add patch to fix this.

CommentFileSizeAuthor
#2 Field-changed-is-unknown-2747373-2.patch834 bytesevaldask

Comments

evaldask created an issue. See original summary.

evaldask’s picture

StatusFileSize
new834 bytes
evaldask’s picture

Status: Active » Needs review
dawehner’s picture

Another solution would be to implement \Drupal\Core\Entity\EntityChangedInterface and and generate the changed field.

timmillwood’s picture

Assigned: evaldask » Unassigned
Status: Needs review » Reviewed & tested by the community

This is definitely my fault.

Not sure why I added the changed trait and not a changed field. Not sure if we need a changed field. I'm not sure we do need one, but also there is no harm really in having one.

For now I am going to RTBC this, I don't think it needs tests because that's kinda like testing if a typo exists or not.

Then as a follow up I think we should discuss the pro and cons of ContentModerationState getting a changed (and created) field.

dawehner’s picture

Fair point. I mean at the moment this certainly doens't provide you anything AND content_moderation is experimental as well.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

I don't think this is bug we shouldn't test - obviously the xmlsitemap module is doing something with the content moderation state entity that is allowed but we're not testing. We should add a test that is doing whatever it is doing.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs tests

Okay scratch that - I think what xmlsitemap is doing it improper - it might have been the only option at the time but things have moved on.

alexpott’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed b0abe17 to 8.3.x and cf0823c to 8.2.x. Thanks!

  • alexpott committed b0abe17 on 8.3.x
    Issue #2813661 by evaldask: A fatal error occurred: Field changed is...

  • alexpott committed cf0823c on 8.2.x
    Issue #2813661 by evaldask: A fatal error occurred: Field changed is...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.