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 |