Issue when calculating count of field using EntityQuery

Created on 24 August 2020, almost 4 years ago
Updated 16 March 2023, over 1 year ago

We attempted to use the "Site Audit" module ( https://www.drupal.org/project/site_audit โ†’ ) which does field audits using the EntityQuery interface. FontAwesome fields generate the following error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'coe_widget__field_coe_widget_icon.field_coe_widget_icon_value' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {coe_widget} base_table INNER JOIN {coe_widget_field_data} coe_widget_field_data ON coe_widget_field_data.id = base_table.id INNER JOIN {coe_widget__field_coe_widget_icon} coe_widget__field_coe_widget_icon ON coe_widget__field_coe_widget_icon.entity_id = base_table.id WHERE (coe_widget_field_data.type = :db_condition_placeholder_0) AND (coe_widget__field_coe_widget_icon.field_coe_widget_icon_value IS NOT NULL) GROUP BY base_table.vid, base_table.id) subquery; Array ( [:db_condition_placeholder_0] => coe_widget_point_of_pride ) in Drupal\site_audit\Plugin\SiteAuditCheck\ContentFieldInstances->calculateScore() (line 96 of /var/www/web/modules/contrib/site_audit/src/Plugin/SiteAuditCheck/ContentFieldInstances.php).

The relevant code block from the Site Audit module:

$query = \Drupal::entityQuery($entity);
          if (!empty($bundle_column_name)) {
            $query->condition($bundle_column_name, $bundle);
          }
          $query->exists($field)
            ->count();
          $field_count = $query->execute();
          $this->registry->field_instance_counts[$bundle][$entity][$field] = $field_count;

It appears as though the EntityQuery system does not know that the FA fields do not use "_value" as a column.

๐Ÿ› Bug report
Status

Closed: outdated

Version

2.17

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States R_H-L

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024