summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-05-04 23:13:51 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-05-04 23:13:51 -0400
commitebc5d852d5386e0aebbc4a816242dced46b3946e (patch)
treef1d26cf7244b78696d45ce4a2acb419ad9514a88 /includes/common.inc
parentedf23f2041761ad55d3cd38057f757bc68acfa5a (diff)
downloadbrdo-ebc5d852d5386e0aebbc4a816242dced46b3946e.tar.gz
brdo-ebc5d852d5386e0aebbc4a816242dced46b3946e.tar.bz2
Issue #1003788 by stefan.r, Alan D., JimmyAx, Josh Waihi, john_brown, twistor, bellHead, bzrudi71, pwolanin, gaas, wiifm, robhardwick, gngn: PostgreSQL PDOException: Invalid text representation when attempting to load an entity with a string or non-scalar ID
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc18
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index a80792e32..b7b9562d4 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7138,6 +7138,23 @@ function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRU
}
/**
+ * Retrieves the type for every field in a table schema.
+ *
+ * @param $table
+ * The name of the table from which to retrieve type information.
+ *
+ * @return
+ * An array of types, keyed by field name.
+ */
+function drupal_schema_field_types($table) {
+ $table_schema = drupal_get_schema($table);
+ foreach ($table_schema['fields'] as $field_name => $field_info) {
+ $field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL;
+ }
+ return $field_types;
+}
+
+/**
* Retrieves a list of fields from a table schema.
*
* The returned list is suitable for use in an SQL query.
@@ -7761,6 +7778,7 @@ function entity_get_info($entity_type = NULL) {
// Prepare entity schema fields SQL info for
// DrupalEntityControllerInterface::buildQuery().
if (isset($entity_info[$name]['base table'])) {
+ $entity_info[$name]['base table field types'] = drupal_schema_field_types($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']);