You are here

protected static function EntityCacheControllerHelper::entityCacheCleanIds in Entity cache 7

Ensures integer entity IDs are valid.

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 PostgreSQL.

Parameters

array $ids: The entity IDs to verify.

Return value

array The sanitized list of entity IDs.

File

includes/entitycache.entitycachecontrollerhelper.inc, line 214
EntityCacheControllerHelper cache helper.

Class

EntityCacheControllerHelper
Entity cache helper.

Code

protected static function entityCacheCleanIds($controller, &$ids) {
  $entity_info = entity_get_info($controller->entityType);
  if (isset($entity_info['base table field types'])) {
    $id_type = $entity_info['base table field types'][$controller->idKey];
    if ($id_type == 'serial' || $id_type == 'int') {
      $ids = array_filter($ids, array(
        __CLASS__,
        'entityCacheFilterId',
      ));
      $ids = array_map('intval', $ids);
    }
  }
}