class MergeRemoteOnlyChanges in Conflict 8.2
Hierarchy
- class \Drupal\conflict\ConflictResolution\MergeStrategyBase implements MergeStrategyInterface
- class \Drupal\conflict\ConflictResolution\MergeRemoteOnlyChanges
Expanded class hierarchy of MergeRemoteOnlyChanges
1 string reference to 'MergeRemoteOnlyChanges'
1 service uses MergeRemoteOnlyChanges
File
- src/
ConflictResolution/ MergeRemoteOnlyChanges.php, line 8
Namespace
Drupal\conflict\ConflictResolutionView source
class MergeRemoteOnlyChanges extends MergeStrategyBase {
/**
* {@inheritdoc}
*/
public function getMergeStrategyId() : string {
return 'conflict.merge_remote_only_changes';
}
/**
* {@inheritdoc}
*/
public function resolveConflictsContentEntity(EntityConflictResolutionEvent $event) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $remote_entity */
$remote_entity = $event
->getRemoteEntity();
/** @var \Drupal\Core\Entity\ContentEntityInterface $result_entity */
$result_entity = $event
->getResultEntity();
foreach ($event
->getConflicts() as $property => $conflict_type) {
if ($conflict_type === ConflictTypes::CONFLICT_TYPE_REMOTE) {
$result_entity
->set($property, $remote_entity
->get($property)
->getValue());
$event
->removeConflict($property);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MergeRemoteOnlyChanges:: |
public | function |
Returns the merge strategy ID. Overrides MergeStrategyInterface:: |
|
MergeRemoteOnlyChanges:: |
public | function |
Resolves conflicts on content entities. Overrides MergeStrategyInterface:: |
|
MergeStrategyBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
MergeStrategyBase:: |
public | function |
Checks whether this merge strategy is active for the conflict resolution. Overrides MergeStrategyInterface:: |
|
MergeStrategyBase:: |
public | function | Discovers conflicts on entities. |