Code Duplication    Length = 9-9 lines in 2 locations

src/Drupal/Driver/Fields/Drupal7/EntityreferenceHandler.php 1 location

@@ 22-30 (lines=9) @@
19
    }
20
21
    $return = array();
22
    foreach ($values as $value) {
23
      $target_id = db_select($entity_info['base table'], 't')
24
        ->fields('t', array($entity_info['entity keys']['id']))
25
        ->condition('t.' . $entity_info['entity keys']['label'], $value)
26
        ->execute()->fetchField();
27
      if ($target_id) {
28
        $return[$this->language][] = array('target_id' => $target_id);
29
      }
30
    }
31
    return $return;
32
  }
33

src/Drupal/Driver/Fields/Drupal7/NodereferenceHandler.php 1 location

@@ 17-25 (lines=9) @@
14
    $entity_type = 'node';
15
    $entity_info = entity_get_info($entity_type);
16
    $return = array();
17
    foreach ($values as $value) {
18
      $nid = db_select($entity_info['base table'], 't')
19
        ->fields('t', array($entity_info['entity keys']['id']))
20
        ->condition('t.' . $entity_info['entity keys']['label'], $value)
21
        ->execute()->fetchField();
22
      if ($nid) {
23
        $return[$this->language][] = array('nid' => $nid);
24
      }
25
    }
26
27
    return $return;
28
  }