Code Duplication    Length = 11-14 lines in 2 locations

src/Relation/BelongsToMany.php 1 location

@@ 36-49 (lines=14) @@
33
        $this->tablename = $tablename;
34
    }
35
36
    protected function initQuery()
37
    {
38
        // set join
39
        // TODO
40
41
        $ids = $this->relation->ids();
42
        foreach ($ids as $property => $id) {
43
            if ($id === null) {
44
                $this->empty = true;
45
            }
46
47
            $this->query->where($this->foreignKey, $id);
48
        }
49
    }
50
51
    public function getResults()
52
    {

src/Relation/HasMany.php 1 location

@@ 15-25 (lines=11) @@
12
13
class HasMany extends Relation
14
{
15
    protected function initQuery()
16
    {
17
        $localKey = $this->localKey;
18
        $value = $this->relation->$localKey;
19
20
        if ($value === null) {
21
            $this->empty = true;
22
        }
23
24
        $this->query->where($this->foreignKey, $value);
25
    }
26
27
    public function getResults()
28
    {