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

@@ 107-115 (lines=9) @@
104
     *
105
     * @return string
106
     */
107
    public function getForeignKey()
108
    {
109
        if (is_null($this->foreignKey)) {
110
            $name = $this->getEntityDescriptor()->getTableName();
111
            $name = Text::singular(strtolower($name));
112
            $this->foreignKey = "{$name}_id";
113
        }
114
        return $this->foreignKey;
115
    }
116
}