Code Duplication    Length = 43-45 lines in 2 locations

src/Drupal/Driver/Plugin/DriverEntity/NodeDrupal8.php 1 location

@@ 19-61 (lines=43) @@
16
 *   },
17
 * )
18
 */
19
class NodeDrupal8 extends DriverEntityPluginDrupal8Base {
20
21
  /**
22
   * The id of the attached node.
23
   *
24
   * @var int
25
   *
26
   * @deprecated Use id() instead.
27
   */
28
  public $nid;
29
30
  /**
31
   * {@inheritdoc}
32
   */
33
  public function load($entityId) {
34
    $entity = parent::load($entityId);
35
    $this->nid = is_null($this->entity) ? NULL : $this->id();
36
    return $entity;
37
  }
38
39
  /**
40
   * {@inheritdoc}
41
   */
42
  public function save() {
43
    parent::save();
44
    $this->nid = $this->id();
45
  }
46
47
  /**
48
   * {@inheritdoc}
49
   */
50
  public function set($identifier, $field) {
51
    if ($identifier === 'author') {
52
      $identifier = 'uid';
53
    }
54
    parent::set($identifier, $field);
55
  }
56
57
}
58

src/Drupal/Driver/Plugin/DriverEntity/TaxonomyTermDrupal8.php 1 location

@@ 19-63 (lines=45) @@
16
 *   },
17
 * )
18
 */
19
class TaxonomyTermDrupal8 extends DriverEntityPluginDrupal8Base {
20
21
  /**
22
   * The id of the attached term.
23
   *
24
   * @var int
25
   *
26
   * @deprecated Use id() instead.
27
   */
28
  public $tid;
29
30
  /**
31
   * {@inheritdoc}
32
   */
33
  public function load($entityId) {
34
    $entity = parent::load($entityId);
35
    $this->tid = is_null($this->entity) ? NULL : $this->id();
36
    return $entity;
37
  }
38
39
  /**
40
   * {@inheritdoc}
41
   */
42
  public function save() {
43
    parent::save();
44
    $this->tid = $this->id();
45
  }
46
47
  /**
48
   * {@inheritdoc}
49
   */
50
  public function getBundleKeyLabels() {
51
    // Previously we made 'vocabulary_machine_name' available as a more
52
    // human-friendly alternative to 'vid' for the bundle field identifier.
53
    // This is now unnecessary as the label 'vocabulary' is available
54
    // automatically, but it is supported here for backwards-compatibility.
55
    $bundleKeyLabels = parent::getBundleKeyLabels();
56
    $bundleKeyLabels[] = 'vocabulary_machine_name';
57
    return $bundleKeyLabels;
58
  }
59
60
}
61