| @@ 42-55 (lines=14) @@ | ||
| 39 | * |
|
| 40 | * @throws SlumberException When no repo is associated with the subject |
|
| 41 | */ |
|
| 42 | public function save($subject) |
|
| 43 | { |
|
| 44 | if (! \is_object($subject)) { |
|
| 45 | return; |
|
| 46 | } |
|
| 47 | ||
| 48 | $repo = $this->getRepositoryByEntity($subject); |
|
| 49 | ||
| 50 | if ($repo === null) { |
|
| 51 | throw new SlumberRuntimeException('No repository is associated with objects of type "' . \get_class($subject) . '"'); |
|
| 52 | } |
|
| 53 | ||
| 54 | $repo->save($subject); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @param mixed $subject |
|
| @@ 62-75 (lines=14) @@ | ||
| 59 | * |
|
| 60 | * @throws SlumberException When no repo is associated with the subject |
|
| 61 | */ |
|
| 62 | public function remove($subject) |
|
| 63 | { |
|
| 64 | if (! \is_object($subject)) { |
|
| 65 | return; |
|
| 66 | } |
|
| 67 | ||
| 68 | $repo = $this->getRepositoryByEntity($subject); |
|
| 69 | ||
| 70 | if ($repo === null) { |
|
| 71 | throw new SlumberRuntimeException('No repository is associated with objects of type "' . \get_class($subject) . '"'); |
|
| 72 | } |
|
| 73 | ||
| 74 | $repo->remove($subject); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @return EntityPool |
|