| @@ 150-162 (lines=13) @@ | ||
| 147 | foreach (array_keys($contentIds) as $destinationContentId) { |
|
| 148 | if (isset($mappedRelations[$relationType][$fieldDefinitionId][$destinationContentId])) { |
|
| 149 | unset($mappedRelations[$relationType][$fieldDefinitionId][$destinationContentId]); |
|
| 150 | } else { |
|
| 151 | $this->persistenceHandler->contentHandler()->addRelation( |
|
| 152 | new SPIRelationCreateStruct( |
|
| 153 | [ |
|
| 154 | 'sourceContentId' => $sourceContentId, |
|
| 155 | 'sourceContentVersionNo' => $sourceContentVersionNo, |
|
| 156 | 'sourceFieldDefinitionId' => $fieldDefinitionId, |
|
| 157 | 'destinationContentId' => $destinationContentId, |
|
| 158 | 'type' => $relationType, |
|
| 159 | ] |
|
| 160 | ) |
|
| 161 | ); |
|
| 162 | } |
|
| 163 | } |
|
| 164 | } |
|
| 165 | } elseif ($relationType === Relation::LINK || $relationType === Relation::EMBED) { |
|
| @@ 169-181 (lines=13) @@ | ||
| 166 | foreach (array_keys($relationData) as $destinationContentId) { |
|
| 167 | if (isset($mappedRelations[$relationType][$destinationContentId])) { |
|
| 168 | unset($mappedRelations[$relationType][$destinationContentId]); |
|
| 169 | } else { |
|
| 170 | $this->persistenceHandler->contentHandler()->addRelation( |
|
| 171 | new SPIRelationCreateStruct( |
|
| 172 | [ |
|
| 173 | 'sourceContentId' => $sourceContentId, |
|
| 174 | 'sourceContentVersionNo' => $sourceContentVersionNo, |
|
| 175 | 'sourceFieldDefinitionId' => null, |
|
| 176 | 'destinationContentId' => $destinationContentId, |
|
| 177 | 'type' => $relationType, |
|
| 178 | ] |
|
| 179 | ) |
|
| 180 | ); |
|
| 181 | } |
|
| 182 | } |
|
| 183 | } |
|
| 184 | } |
|