Code Duplication    Length = 7-8 lines in 2 locations

src/relationships/HasManyRelationship.php 1 location

@@ 39-45 (lines=7) @@
36
    {
37
        // @todo throw an exception when the data doesn't have the local key
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
47
        return $query;
48
    }

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
    }