MergeRemoteOnlyChanges.php in Conflict 8.2
File
src/ConflictResolution/MergeRemoteOnlyChanges.php
View source
<?php
namespace Drupal\conflict\ConflictResolution;
use Drupal\conflict\ConflictTypes;
use Drupal\conflict\Event\EntityConflictResolutionEvent;
class MergeRemoteOnlyChanges extends MergeStrategyBase {
public function getMergeStrategyId() : string {
return 'conflict.merge_remote_only_changes';
}
public function resolveConflictsContentEntity(EntityConflictResolutionEvent $event) {
$remote_entity = $event
->getRemoteEntity();
$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);
}
}
}
}