Code Duplication    Length = 43-45 lines in 2 locations

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

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

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

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