source/Spiral/ORM/Entities/Relations/BelongsTo.php 1 location
|
@@ 79-82 (lines=4) @@
|
| 76 |
|
//Key in child record |
| 77 |
|
$innerKey = $this->definition[RecordEntity::INNER_KEY]; |
| 78 |
|
|
| 79 |
|
if ($this->parent->getField($innerKey, false) != $related->getField($outerKey, false)) { |
| 80 |
|
//We are going to set relation keys right on assertion |
| 81 |
|
$this->parent->setField($innerKey, $related->getField($outerKey, false)); |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
/** |
source/Spiral/ORM/Entities/Relations/HasOne.php 1 location
|
@@ 69-71 (lines=3) @@
|
| 66 |
|
//Key in parent record |
| 67 |
|
$innerKey = $this->definition[RecordEntity::INNER_KEY]; |
| 68 |
|
|
| 69 |
|
if ($record->getField($outerKey, false) != $this->parent->getField($innerKey, false)) { |
| 70 |
|
$record->setField($outerKey, $this->parent->getField($innerKey, false)); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
if (!isset($this->definition[RecordEntity::MORPH_KEY])) { |
| 74 |
|
//No morph key presented |