| @@ 121-142 (lines=22) @@ | ||
| 118 | ); |
|
| 119 | } |
|
| 120 | ||
| 121 | private function updateJSONLD($eventId, $callback) |
|
| 122 | { |
|
| 123 | $document = $this->repository->get($eventId); |
|
| 124 | ||
| 125 | if (!$document) { |
|
| 126 | return; |
|
| 127 | } |
|
| 128 | ||
| 129 | $eventLD = $document->getBody(); |
|
| 130 | ||
| 131 | $newEventLD = clone $eventLD; |
|
| 132 | ||
| 133 | $callback($newEventLD); |
|
| 134 | ||
| 135 | if ($newEventLD == $eventLD) { |
|
| 136 | return; |
|
| 137 | } |
|
| 138 | ||
| 139 | $document = $document->withBody($newEventLD); |
|
| 140 | ||
| 141 | $this->repository->save($document); |
|
| 142 | } |
|
| 143 | } |
|
| 144 | ||
| @@ 69-87 (lines=19) @@ | ||
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | private function updateEmbeddedOrganizer(string $placeId, $organizerJSONLD) |
|
| 70 | { |
|
| 71 | $document = $this->repository->get($placeId); |
|
| 72 | ||
| 73 | if (!$document) { |
|
| 74 | return; |
|
| 75 | } |
|
| 76 | ||
| 77 | $placeLD = $document->getBody(); |
|
| 78 | ||
| 79 | $newPlaceLD = clone $placeLD; |
|
| 80 | $newPlaceLD->organizer = $organizerJSONLD; |
|
| 81 | ||
| 82 | if ($newPlaceLD == $placeLD) { |
|
| 83 | return; |
|
| 84 | } |
|
| 85 | ||
| 86 | $this->repository->save($document->withBody($newPlaceLD)); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||