| @@ 139-156 (lines=18) @@ | ||
| 136 | /** |
|
| 137 | * @param PlaceImportedFromUDB2Event $eventImportedFromUDB2 |
|
| 138 | */ |
|
| 139 | protected function applyPlaceImportedFromUDB2Event( |
|
| 140 | PlaceImportedFromUDB2Event $eventImportedFromUDB2 |
|
| 141 | ) { |
|
| 142 | $udb2Event = EventItemFactory::createEventFromCdbXml( |
|
| 143 | $eventImportedFromUDB2->getCdbXmlNamespaceUri(), |
|
| 144 | $eventImportedFromUDB2->getCdbXml() |
|
| 145 | ); |
|
| 146 | ||
| 147 | $document = $this->newDocument($eventImportedFromUDB2->getActorId()); |
|
| 148 | $placeLd = $document->getBody(); |
|
| 149 | ||
| 150 | $placeLd = $this->cdbXMLImporter->eventDocumentWithCdbXML( |
|
| 151 | $placeLd, |
|
| 152 | $udb2Event |
|
| 153 | ); |
|
| 154 | ||
| 155 | $this->repository->save($document->withBody($placeLd)); |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|
| 159 | * @param string $id |
|
| @@ 56-73 (lines=18) @@ | ||
| 53 | /** |
|
| 54 | * @param OrganizerImportedFromUDB2 $organizerImportedFromUDB2 |
|
| 55 | */ |
|
| 56 | public function applyOrganizerImportedFromUDB2( |
|
| 57 | OrganizerImportedFromUDB2 $organizerImportedFromUDB2 |
|
| 58 | ) { |
|
| 59 | $udb2Actor = ActorItemFactory::createActorFromCdbXml( |
|
| 60 | $organizerImportedFromUDB2->getCdbXmlNamespaceUri(), |
|
| 61 | $organizerImportedFromUDB2->getCdbXml() |
|
| 62 | ); |
|
| 63 | ||
| 64 | $document = $this->newDocument($organizerImportedFromUDB2->getActorId()); |
|
| 65 | $actorLd = $document->getBody(); |
|
| 66 | ||
| 67 | $actorLd = $this->cdbXMLImporter->documentWithCdbXML( |
|
| 68 | $actorLd, |
|
| 69 | $udb2Actor |
|
| 70 | ); |
|
| 71 | ||
| 72 | $this->repository->save($document->withBody($actorLd)); |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * @param OrganizerCreated $organizerCreated |
|
| @@ 188-214 (lines=27) @@ | ||
| 185 | /** |
|
| 186 | * @param OrganizerUpdatedFromUDB2 $organizerUpdatedFromUDB2 |
|
| 187 | */ |
|
| 188 | public function applyOrganizerUpdatedFromUDB2( |
|
| 189 | OrganizerUpdatedFromUDB2 $organizerUpdatedFromUDB2 |
|
| 190 | ) { |
|
| 191 | // It's possible that an organizer has been deleted in udb3, but never |
|
| 192 | // in udb2. If an update comes for that organizer from udb2, it should |
|
| 193 | // be imported again. This is intended by design. |
|
| 194 | // @see https://jira.uitdatabank.be/browse/III-1092 |
|
| 195 | try { |
|
| 196 | $document = $this->loadDocumentFromRepository( |
|
| 197 | $organizerUpdatedFromUDB2 |
|
| 198 | ); |
|
| 199 | } catch (DocumentGoneException $e) { |
|
| 200 | $document = $this->newDocument($organizerUpdatedFromUDB2->getActorId()); |
|
| 201 | } |
|
| 202 | ||
| 203 | $udb2Actor = ActorItemFactory::createActorFromCdbXml( |
|
| 204 | $organizerUpdatedFromUDB2->getCdbXmlNamespaceUri(), |
|
| 205 | $organizerUpdatedFromUDB2->getCdbXml() |
|
| 206 | ); |
|
| 207 | ||
| 208 | $actorLd = $this->cdbXMLImporter->documentWithCdbXML( |
|
| 209 | $document->getBody(), |
|
| 210 | $udb2Actor |
|
| 211 | ); |
|
| 212 | ||
| 213 | $this->repository->save($document->withBody($actorLd)); |
|
| 214 | } |
|
| 215 | ||
| 216 | /** |
|
| 217 | * @param LabelAdded $labelAdded |
|