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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | elastic_search-2930518-back-reference-status.patch | 2.17 KB | beutlerk |
Comments
Comment #2
beutlerk commentedComment #3
cburschkaComment #5
aless_io commentedPatch committed, thank you.