@@ 391-401 (lines=11) @@ | ||
388 | * @param Embed $embed The embed to remove from the collection. |
|
389 | * @return self |
|
390 | */ |
|
391 | public function removeEmbed($key, Embed $embed) |
|
392 | { |
|
393 | if (false === $this->isEmbedHasMany($key)) { |
|
394 | return $this; |
|
395 | } |
|
396 | $this->touch(); |
|
397 | $collection = $this->hasManyEmbeds->get($key); |
|
398 | $collection->remove($embed); |
|
399 | $this->doDirtyCheck(); |
|
400 | return $this; |
|
401 | } |
|
402 | ||
403 | /** |
|
404 | * Rolls back a model to its original values. |
|
@@ 627-636 (lines=10) @@ | ||
624 | * @param Embed|null $embed The embed to relate. |
|
625 | * @return self |
|
626 | */ |
|
627 | protected function setEmbedHasOne($key, Embed $embed = null) |
|
628 | { |
|
629 | if (null !== $embed) { |
|
630 | $this->validateEmbedSet($key, $embed->getName()); |
|
631 | } |
|
632 | $this->touch(); |
|
633 | $this->hasOneEmbeds->set($key, $embed); |
|
634 | $this->doDirtyCheck(); |
|
635 | return $this; |
|
636 | } |
|
637 | ||
638 | /** |
|
639 | * Touches the model. |