summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc8
-rw-r--r--includes/entity.inc4
2 files changed, 10 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 03bf41151..07422d08d 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -6689,6 +6689,14 @@ function entity_get_info($entity_type = NULL) {
if (empty($entity_info[$name]['entity keys']['bundle']) && empty($entity_info[$name]['bundles'])) {
$entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label']));
}
+ // Prepare entity schema fields SQL info for
+ // DrupalEntityControllerInterface::buildQuery().
+ if (isset($entity_info[$name]['base table'])) {
+ $entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
+ if (isset($entity_info[$name]['revision table'])) {
+ $entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']);
+ }
+ }
}
// Let other modules alter the entity info.
drupal_alter('entity_info', $entity_info);
diff --git a/includes/entity.inc b/includes/entity.inc
index 59473c276..b67a31798 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -251,11 +251,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
}
// Add fields from the {entity} table.
- $entity_fields = drupal_schema_fields_sql($this->entityInfo['base table']);
+ $entity_fields = $this->entityInfo['schema_fields_sql']['base table'];
if ($this->revisionKey) {
// Add all fields from the {entity_revision} table.
- $entity_revision_fields = drupal_map_assoc(drupal_schema_fields_sql($this->revisionTable));
+ $entity_revision_fields = drupal_map_assoc($this->entityInfo['schema_fields_sql']['revision table']);
// The id field is provided by entity, so remove it.
unset($entity_revision_fields[$this->idKey]);