| @@ 186-199 (lines=14) @@ | ||
| 183 | /** |
|
| 184 | * {@inheritdoc} |
|
| 185 | */ |
|
| 186 | public function createOrUpdate(ObjectInterface $object) |
|
| 187 | { |
|
| 188 | if (!$object instanceof ContentObject) { |
|
| 189 | throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object)); |
|
| 190 | } |
|
| 191 | ||
| 192 | try { |
|
| 193 | $this->find($object); |
|
| 194 | ||
| 195 | return $this->update($object); |
|
| 196 | } catch (NotFoundException $notFound) { |
|
| 197 | return $this->create($object); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | /** |
|
| 202 | * {@inheritdoc} |
|
| @@ 182-195 (lines=14) @@ | ||
| 179 | /** |
|
| 180 | * {@inheritdoc} |
|
| 181 | */ |
|
| 182 | public function createOrUpdate(ObjectInterface $object) |
|
| 183 | { |
|
| 184 | if (!$object instanceof LocationObject) { |
|
| 185 | throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); |
|
| 186 | } |
|
| 187 | ||
| 188 | try { |
|
| 189 | $this->find($object); |
|
| 190 | ||
| 191 | return $this->update($object); |
|
| 192 | } catch (NotFoundException $notFound) { |
|
| 193 | return $this->create($object); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * Creates/updates/deletes locations in ContentObject->parent_locations. |
|
| @@ 251-262 (lines=12) @@ | ||
| 248 | /** |
|
| 249 | * {@inheritdoc} |
|
| 250 | */ |
|
| 251 | public function remove(ObjectInterface $object) |
|
| 252 | { |
|
| 253 | if (!$object instanceof LocationObject) { |
|
| 254 | throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); |
|
| 255 | } |
|
| 256 | ||
| 257 | if ($location = $this->find($object)) { |
|
| 258 | $this->locationService->deleteLocation($location); |
|
| 259 | } |
|
| 260 | ||
| 261 | return true; |
|
| 262 | } |
|
| 263 | ||
| 264 | /** |
|
| 265 | * Hides a location. |
|