| @@ 173-186 (lines=14) @@ | ||
| 170 | /** |
|
| 171 | * {@inheritdoc} |
|
| 172 | */ |
|
| 173 | public function createOrUpdate(ObjectInterface $object) |
|
| 174 | { |
|
| 175 | if (!$object instanceof LocationObject) { |
|
| 176 | throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); |
|
| 177 | } |
|
| 178 | ||
| 179 | try { |
|
| 180 | $this->find($object); |
|
| 181 | ||
| 182 | return $this->update($object); |
|
| 183 | } catch (NotFoundException $notFound) { |
|
| 184 | return $this->create($object); |
|
| 185 | } |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * Creates/updates/deletes locations in ContentObject->parent_locations. |
|
| @@ 242-253 (lines=12) @@ | ||
| 239 | /** |
|
| 240 | * {@inheritdoc} |
|
| 241 | */ |
|
| 242 | public function remove(ObjectInterface $object) |
|
| 243 | { |
|
| 244 | if (!$object instanceof LocationObject) { |
|
| 245 | throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object)); |
|
| 246 | } |
|
| 247 | ||
| 248 | if ($location = $this->find($object)) { |
|
| 249 | $this->locationService->deleteLocation($location); |
|
| 250 | } |
|
| 251 | ||
| 252 | return true; |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * Hides a location. |
|
| @@ 184-197 (lines=14) @@ | ||
| 181 | /** |
|
| 182 | * {@inheritdoc} |
|
| 183 | */ |
|
| 184 | public function createOrUpdate(ObjectInterface $object) |
|
| 185 | { |
|
| 186 | if (!$object instanceof ContentObject) { |
|
| 187 | throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object)); |
|
| 188 | } |
|
| 189 | ||
| 190 | try { |
|
| 191 | $this->find($object); |
|
| 192 | ||
| 193 | return $this->update($object); |
|
| 194 | } catch (NotFoundException $notFound) { |
|
| 195 | return $this->create($object); |
|
| 196 | } |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * {@inheritdoc} |
|