Code Duplication    Length = 13-13 lines in 2 locations

src/Form/Elements/Tree.php 1 location

@@ 59-71 (lines=13) @@
56
        }
57
    }
58
59
    public function finishSave()
60
    {
61
        if (!($this->isNodesModel() && $this->isRelation())) {
62
            return;
63
        }
64
        $attribute = $this->getName();
65
        $values    = $this->getValueFromRequest();
66
67
        $relation = $this->getModel()->{$attribute}();
68
        if ($relation instanceof BelongsToMany) {
69
            $relation->sync($values);
70
        }
71
    }
72
73
    protected function isNodesModel()
74
    {

src/Form/Elements/MultiSelect.php 1 location

@@ 31-43 (lines=13) @@
28
        return $value;
29
    }
30
31
    public function finishSave()
32
    {
33
        if (!($this->isOptionsModel() && $this->isRelation())) {
34
            return;
35
        }
36
        $attribute = $this->getName();
37
        $values = $this->getValueFromRequest();
38
39
        $relation = $this->getModel()->{$attribute}();
40
        if ($relation instanceof BelongsToMany) {
41
            $relation->sync($values);
42
        }
43
    }
44
45
    public function toArray()
46
    {