BackReferenceProcessor::getReferencingEntities() assumes that the referencing entity type has a "status" field, but this isn't true for all fieldable entity types.

Eg. if a contact message (using https://drupal.org/project/contact_storage) has a taxonomy reference field, then updating the taxonomy term causes the following exception:

Drupal\Core\Entity\EntityStorageException: 'status' not found in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 777 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Entity\Query\Sql\Tables->addField('status', 'INNER', NULL) (Line: 44)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 155)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 74)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 141)
Drupal\elastic_search\Elastic\BackReferenceProcessor->getReferencingEntities(Object, '346') (Line: 118)

The function should load the entity type definition and check for a "published" key ($entityType->getKey('published')), and only set the condition if that key exists.

Comments

cburschka created an issue. See original summary.

beutlerk’s picture

cburschka’s picture

Status: Active » Needs review

  • aless_io committed 6cb2f43 on 8.x-1.x authored by beutlerk
    Issue #2930518 by beutlerk: EntityStorageException when updating entity...
aless_io’s picture

Status: Needs review » Fixed

Patch committed, thank you.

Status: Fixed » Closed (fixed)

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