class EntityConflictResolutionEvent in Conflict 8.2
Hierarchy
- class \Drupal\conflict\Event\EntityConflictDiscoveryEvent extends \Symfony\Component\EventDispatcher\Event
- class \Drupal\conflict\Event\EntityConflictResolutionEvent
Expanded class hierarchy of EntityConflictResolutionEvent
5 files declare their use of EntityConflictResolutionEvent
- ConflictResolverManager.php in src/
ConflictResolver/ ConflictResolverManager.php - MergeRemoteOnlyChanges.php in src/
ConflictResolution/ MergeRemoteOnlyChanges.php - MergeRemoteStructure.php in modules/
conflict_paragraphs/ src/ ConflictResolution/ MergeRemoteStructure.php - MergeStrategyBase.php in src/
ConflictResolution/ MergeStrategyBase.php - MergeStrategyInterface.php in src/
ConflictResolution/ MergeStrategyInterface.php
File
- src/
Event/ EntityConflictResolutionEvent.php, line 8
Namespace
Drupal\conflict\EventView source
class EntityConflictResolutionEvent extends EntityConflictDiscoveryEvent {
/**
* The result entity.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
protected $resultEntity;
/**
* Constructs a conflict discovery event object.
*
* @param \Drupal\Core\Entity\EntityInterface $local
* The local part of the comparision - for example the entity built of the
* user input on an entity form submission. This is basically the active
* entity object.
* @param \Drupal\Core\Entity\EntityInterface $remote
* The remote part of the comparision - for example the current version of
* the entity from the storage.
* @param \Drupal\Core\Entity\EntityInterface $base
* The initial entity version in concurrent editing or the lowest common
* ancestor in a revision tree scenario.
* @param \Drupal\Core\Entity\EntityInterface $result
* The result entity, on which to apply the result. Usually this will be the
* active entity object - the local entity.
* @param array $conflicts
* The conflicts.
* @param \Symfony\Component\HttpFoundation\ParameterBag $context
* (optional) The context parameter bag.
*/
public function __construct(EntityInterface $local, EntityInterface $remote, EntityInterface $base, EntityInterface $result, array $conflicts, ParameterBag $context = NULL) {
parent::__construct($local, $remote, $base, $context);
$this->conflicts = $conflicts;
$this->resultEntity = $result;
}
/**
* Creates a conflict resolution event object from a conflict discovery event.
*
* @param \Drupal\conflict\Event\EntityConflictDiscoveryEvent
* The conflict discovery event.
* @param \Drupal\Core\Entity\EntityInterface $result
* The result entity, on which to apply the result.
*
* @return static
*/
public static function createFromConflictDiscoveryEvent(EntityConflictDiscoveryEvent $event, EntityInterface $result) {
return new static($event->LocalEntity, $event->RemoteEntity, $event->baseEntity, $result, $event->conflicts, $event->context);
}
/**
* Returns the result entity.
*
* @return \Drupal\Core\Entity\EntityInterface
*/
public function getResultEntity() : EntityInterface {
return $this->resultEntity;
}
/**
* Removes a conflict.
*
* This method should called when a conflict has been resolved or the property
* value on the resulting entity satisfies the merge strategy.
*
* @param string $property
* The conflicting property.
*/
public function removeConflict($property) {
unset($this->conflicts[$property]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityConflictDiscoveryEvent:: |
protected | property | The base entity. | |
EntityConflictDiscoveryEvent:: |
protected | property | An array containing the conflicting properties. | |
EntityConflictDiscoveryEvent:: |
protected | property | A context parameter bag. | |
EntityConflictDiscoveryEvent:: |
protected | property | The local entity. | |
EntityConflictDiscoveryEvent:: |
protected | property | The remote entity. | |
EntityConflictDiscoveryEvent:: |
public | function | Adds a conflicting property. | |
EntityConflictDiscoveryEvent:: |
public | function | Returns the base entity. | |
EntityConflictDiscoveryEvent:: |
public | function | Returns the conflicts. | |
EntityConflictDiscoveryEvent:: |
public | function | Returns a parameter value from the context bag. | |
EntityConflictDiscoveryEvent:: |
public | function | Return the local entity. | |
EntityConflictDiscoveryEvent:: |
public | function | Returns the remote entity. | |
EntityConflictResolutionEvent:: |
protected | property | The result entity. | |
EntityConflictResolutionEvent:: |
public static | function | Creates a conflict resolution event object from a conflict discovery event. | |
EntityConflictResolutionEvent:: |
public | function | Returns the result entity. | |
EntityConflictResolutionEvent:: |
public | function | Removes a conflict. | |
EntityConflictResolutionEvent:: |
public | function |
Constructs a conflict discovery event object. Overrides EntityConflictDiscoveryEvent:: |