diff --git a/pathauto.install b/pathauto.install index 82edccf..b8ecbb5 100644 --- a/pathauto.install +++ b/pathauto.install @@ -21,8 +21,8 @@ function pathauto_schema() { 'description' => 'An entity type.', ), 'entity_id' => array( - 'type' => 'varchar', - 'length' => 255, + 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'description' => 'An entity ID.', ), @@ -235,8 +235,8 @@ function pathauto_update_7006() { 'description' => 'An entity type.', ), 'entity_id' => array( - 'type' => 'varchar', - 'length' => 255, + 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'description' => 'An entity ID.', ), @@ -256,12 +256,6 @@ function pathauto_update_7006() { // that we can cleanly disable that module. db_rename_table('pathauto_persist', 'pathauto_state'); db_create_table('pathauto_persist', $schema['pathauto_state']); - // Change the entity_id column to varchar because the entity system does - // not assume serial or integer IDs (see [#1823494]). - db_drop_primary_key('pathauto_state'); - db_change_field('pathauto_state', 'entity_id', 'entity_id', - array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'An entity ID.')); - db_add_primary_key('pathauto_state', array('entity_type', 'entity_id')); // Disable the module and inform the user. if (module_exists('pathauto_persist')) { module_disable(array('pathauto_persist')); diff --git a/pathauto.module b/pathauto.module index e420e57..d83de6c 100644 --- a/pathauto.module +++ b/pathauto.module @@ -454,6 +454,12 @@ function pathauto_entity_state_load($entity_type, $entity_id) { */ function pathauto_entity_state_load_multiple($entity_type, $entity_ids) { try { + // filter out entity_ids that are not integers + $entity_ids = array_filter($entity_ids, 'is_numeric'); + // if everything was filtered out, return an empty array + if(empty($entity_ids)) { + return array(); + } $pathauto_state = db_query("SELECT entity_id, pathauto FROM {pathauto_state} WHERE entity_type = :entity_type AND entity_id IN (:entity_ids)", array(':entity_type' => $entity_type, ':entity_ids' => $entity_ids))->fetchAllKeyed();