@@ 407-417 (lines=11) @@ | ||
404 | * @param Embed $embed The embed to remove from the collection. |
|
405 | * @return self |
|
406 | */ |
|
407 | public function removeEmbed($key, Embed $embed) |
|
408 | { |
|
409 | if (false === $this->isEmbedHasMany($key)) { |
|
410 | return $this; |
|
411 | } |
|
412 | $this->touch(); |
|
413 | $collection = $this->hasManyEmbeds->get($key); |
|
414 | $collection->remove($embed); |
|
415 | $this->doDirtyCheck(); |
|
416 | return $this; |
|
417 | } |
|
418 | ||
419 | /** |
|
420 | * Rolls back a model to its original values. |
|
@@ 643-652 (lines=10) @@ | ||
640 | * @param Embed|null $embed The embed to relate. |
|
641 | * @return self |
|
642 | */ |
|
643 | protected function setEmbedHasOne($key, Embed $embed = null) |
|
644 | { |
|
645 | if (null !== $embed) { |
|
646 | $this->validateEmbedSet($key, $embed->getName()); |
|
647 | } |
|
648 | $this->touch(); |
|
649 | $this->hasOneEmbeds->set($key, $embed); |
|
650 | $this->doDirtyCheck(); |
|
651 | return $this; |
|
652 | } |
|
653 | ||
654 | /** |
|
655 | * Touches the model. |