Code Duplication    Length = 5-6 lines in 3 locations

src/relationships/BelongsToRelationship.php 1 location

@@ 55-60 (lines=6) @@
52
        $query = $this->getQuery();
53
        if ($this->queryPrepared) {
54
            $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]);
55
        } else {
56
            $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
57
                ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']])
58
                ->setFirstOnly(true);
59
            $this->queryPrepared = true;
60
        }
61
        return $query;
62
    }
63

src/relationships/HasManyRelationship.php 1 location

@@ 41-45 (lines=5) @@
38
        $query = $this->getQuery();
39
        if ($this->queryPrepared) {
40
            $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]);
41
        } else {
42
            $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
43
                    ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']]);
44
            $this->queryPrepared = true;
45
        }
46
        return $query;
47
    }
48

src/relationships/ManyHaveManyRelationship.php 1 location

@@ 60-65 (lines=6) @@
57
        $query = $this->getQuery();
58
        if ($this->queryPrepared) {
59
            $query->setBoundData($this->options['foreign_key'], $foreignKeys);
60
        } else {
61
            $query = $this->getQuery()
62
                    ->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
63
                    ->addFilter($this->options['foreign_key'], $foreignKeys);
64
            $this->queryPrepared = true;
65
        }
66
        return $query;
67
    }
68