Commit eb3c8b1e authored by catch's avatar catch

Revert "Issue #1003788 by stefan.r, Alan D., Josh Waihi, JimmyAx, robhardwick,...

Revert "Issue #1003788 by stefan.r, Alan D., Josh Waihi, JimmyAx, robhardwick, wiifm, twistor, pwolanin, bzrudi71, bellHead, john_brown: Fixed PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID."

This reverts commit 4086829b.
parent 9601e39d
......@@ -342,10 +342,6 @@ public function getTableMapping() {
* {@inheritdoc}
*/
protected function doLoadMultiple(array $ids = NULL) {
if (!empty($ids)) {
$ids = $this->cleanIds($ids);
}
// Build and execute the query.
$records = $this
->buildQuery($ids)
......@@ -355,39 +351,6 @@ protected function doLoadMultiple(array $ids = NULL) {
return $this->mapFromStorageRecords($records);
}
/**
* Sanitizes the entity IDs to the correct data type.
*
* The identifier sanitization provided by this method has been introduced
* as Drupal used to rely on the database to facilitate this, which worked
* correctly with MySQL but led to errors with other DBMS such as PostgeSQL.
*
* @param array $ids
* The entity IDs to verify.
* @return array
* The sanitized list of entity IDs.
*/
protected function cleanIds(array $ids) {
$keys = $this->entityType->getKeys();
$bundle = $keys['bundle'] ? $keys['bundle'] : $this->entityTypeId;
$definitions = $this->entityManager->getFieldDefinitions($this->entityTypeId, $bundle);
$info = $this->entityManager->getDefinition($this->entityTypeId);
$id_definition = $definitions[$info->getKey('id')];
switch ($id_definition->getType()) {
case 'integer':
$ids = array_filter($ids, 'is_numeric');
$ids = array_map('intval', $ids);
break;
case 'string':
$ids = array_filter($ids, 'is_string');
$ids = array_map('strval', $ids);
break;
}
return $ids;
}
/**
* Maps from storage records to entity objects.
*
......
......@@ -76,11 +76,6 @@ function testEntityViewController() {
$this->assertRaw($entity->label());
$this->assertRaw('full');
}
// As entity_test IDs must be integers, make sure requests for non-integer
// IDs return a page not found error.
$this->drupalGet('entity_test/invalid');
$this->assertResponse(404);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment