Code Duplication    Length = 7-8 lines in 2 locations

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
    }

src/relationships/BelongsToRelationship.php 1 location

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