class ConflictResolverManager in Conflict 8.2
Manages conflict resolving.
Hierarchy
- class \Drupal\conflict\ConflictResolver\ConflictResolverManager implements ConflictResolverManagerInterface
Expanded class hierarchy of ConflictResolverManager
1 string reference to 'ConflictResolverManager'
1 service uses ConflictResolverManager
File
- src/
ConflictResolver/ ConflictResolverManager.php, line 15
Namespace
Drupal\conflict\ConflictResolverView source
class ConflictResolverManager implements ConflictResolverManagerInterface {
/**
* The event dispatcher used to notify subscribers.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* Constructs a new Conflict Resolver Manager.
*
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher used to notify subscribers of config import events.
*/
public function __construct(EventDispatcherInterface $event_dispatcher) {
$this->eventDispatcher = $event_dispatcher;
}
/**
* {@inheritdoc}
*/
public function resolveConflicts(EntityInterface $local, EntityInterface $remote, EntityInterface $base, EntityInterface $result = NULL, ParameterBag $context = NULL, array $conflicts = NULL) : array {
// If none conflicts are given, then explicitly discover the conflicts.
$conflicts = $conflicts ?? $this
->getConflicts($local, $remote, $base, $context);
if ($conflicts) {
$result = $result ?? $local;
$event = new EntityConflictResolutionEvent($local, $remote, $base, $result, $conflicts, $context);
// Fire an event to allow listeners to automatically resolve conflicts.
$this->eventDispatcher
->dispatch(EntityConflictEvents::ENTITY_CONFLICT_RESOLVE, $event);
$conflicts = $event
->getConflicts();
}
return $conflicts;
}
/**
* {@inheritdoc}
*/
public function getConflicts(EntityInterface $local, EntityInterface $remote, EntityInterface $base, ParameterBag $context = NULL) : array {
$event = new EntityConflictDiscoveryEvent($local, $remote, $base, $context);
// Fire an event to allow listeners to build a list of conflicting
// properties.
$this->eventDispatcher
->dispatch(EntityConflictEvents::ENTITY_CONFLICT_DISCOVERY, $event);
return $event
->getConflicts();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConflictResolverManager:: |
protected | property | The event dispatcher used to notify subscribers. | |
ConflictResolverManager:: |
public | function |
Returns the conflicts between two entities based on their common parent.
* Overrides ConflictResolverManagerInterface:: |
|
ConflictResolverManager:: |
public | function |
Resolves the conflicts between two entities based on their common parent. Overrides ConflictResolverManagerInterface:: |
|
ConflictResolverManager:: |
public | function | Constructs a new Conflict Resolver Manager. |