- Issue created by @Dozz
- Status changed to Needs review
over 1 year ago 12:30pm 23 June 2023 - last update
over 1 year ago 86 pass
I get the following fatal error message when trying to check links on entities that have no bundle.
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.' in 'where clause'.
Entities without a bundle are considered as having exactly one bundle. The bundle is the same the entity type id but they don't have a bundle key so the following lines result in the exception.
if (!empty($bundle)) {
$query->condition('base.' . $entityType->getKey('bundle'), $bundle);
}
Also check that the bundle key is not empty.
if (!empty($bundle) && $entityType->getKey('bundle')) {
$query->condition('base.' . $entityType->getKey('bundle'), $bundle);
}
Needs review
2.0
Code