Code Duplication    Length = 6-6 lines in 2 locations

src/relationships/BelongsToRelationship.php 1 location

@@ 53-58 (lines=6) @@
50
        $query = $this->createQuery();
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
    }

src/relationships/HasManyRelationship.php 1 location

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