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