Code Duplication    Length = 7-8 lines in 2 locations

src/relationships/BelongsToRelationship.php 1 location

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

src/relationships/HasManyRelationship.php 1 location

@@ 42-48 (lines=7) @@
39
    {
40
        // @todo throw an exception when the data doesn't have the local key
41
        $query = $this->getQuery();
42
        if ($this->queryPrepared) {
43
            $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]);
44
        } else {
45
            $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
46
                    ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']]);
47
            $this->queryPrepared = true;
48
        }
49
50
        return $query;
51
    }