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