Code Duplication    Length = 9-9 lines in 3 locations

src/Mapper/Relation/AbstractRelation.php 1 location

@@ 154-162 (lines=9) @@
151
     *
152
     * @return string
153
     */
154
    public function getForeignKey()
155
    {
156
        if (is_null($this->foreignKey)) {
157
            $name = $this->getParentEntityDescriptor()->getTableName();
158
            $name = Text::singular(strtolower($name));
159
            $this->foreignKey = "{$name}_id";
160
        }
161
        return $this->foreignKey;
162
    }
163
164
    /**
165
     * Register the retrieved entities in the repository identity map

src/Mapper/Relation/HasOne.php 1 location

@@ 57-65 (lines=9) @@
54
     *
55
     * @return string
56
     */
57
    public function getForeignKey()
58
    {
59
        if (is_null($this->foreignKey)) {
60
            $name = $this->getEntityDescriptor()->getTableName();
61
            $name = Text::singular(strtolower($name));
62
            $this->foreignKey = "{$name}_id";
63
        }
64
        return $this->foreignKey;
65
    }
66
67
    /**
68
     * Loads the entity or entity collection for this relation

src/Mapper/Relation/HasMany.php 1 location

@@ 134-142 (lines=9) @@
131
     *
132
     * @return string
133
     */
134
    public function getForeignKey()
135
    {
136
        if (is_null($this->foreignKey)) {
137
            $name = $this->getEntityDescriptor()->getTableName();
138
            $name = Text::singular(strtolower($name));
139
            $this->foreignKey = "{$name}_id";
140
        }
141
        return $this->foreignKey;
142
    }
143
}