Code Duplication    Length = 13-13 lines in 2 locations

components/terms/PropertyTerm.php 1 location

@@ 78-90 (lines=13) @@
75
    public function removeTerm($object_id, $params = [])
76
    {
77
        $terms = $this->getTerms($object_id, $params);
78
        foreach($terms as $term => $value) {
79
            $term = $this->getTaxonomyTerm($term);
80
            $data['term_id'] = $term->id;
81
            $data['object_id'] = $object_id;
82
83
            $query = new Query();
84
            if ($query->from($this->getTable())->where($data)->exists($this->getDb())) {
85
                $this->getDb()->createCommand()->delete($this->getTable(), $data)->execute();
86
87
                $term->updateCounters(['total_count' => -1]);
88
                TaxonomyDef::updateAllCounters(['total_count' => -1], [ 'id' => $this->id ]);
89
            }
90
        }
91
    }
92
93
    public function getTerms($object_id, $name = [])

components/terms/BaseTerm.php 1 location

@@ 42-54 (lines=13) @@
39
            $params = $this->getTerms($object_id);
40
        }
41
42
        foreach($params as $item) {
43
            $term = $this->getTaxonomyTerm($item);
44
            $data['term_id'] = $term->id;
45
            $data['object_id'] = $object_id;
46
47
            $query = new Query();
48
            if ($query->from($this->table)->where($data)->exists($this->getDb())) {
49
                $this->getDb()->createCommand()->delete($this->table, $data)->execute();
50
51
                $term->updateCounters(['total_count' => -1]);
52
                Taxonomydef::updateAllCounters(['total_count' => -1], [ 'id' => $this->id ]);
53
            }
54
        }
55
    }
56
57
    public function getTerms($object_id = null, $name = [])