class LoadLocalEntityEvent in Acquia Content Hub 8.2
Class LoadLocalEntityEvent.
Matches remote entities with local entities.
@package Drupal\acquia_contenthub\Event
Hierarchy
- class \Drupal\acquia_contenthub\Event\LoadLocalEntityEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of LoadLocalEntityEvent
7 files declare their use of LoadLocalEntityEvent
- CreateStubs.php in src/
EventSubscriber/ ImportFailure/ CreateStubs.php - EntityCdfSerializer.php in src/
EntityCdfSerializer.php - LoadEntityByUuid.php in src/
EventSubscriber/ LoadLocalEntity/ LoadEntityByUuid.php - LoadFromTrackingData.php in modules/
acquia_contenthub_subscriber/ src/ EventSubscriber/ LoadLocalEntity/ LoadFromTrackingData.php - LoadMatchingRedirect.php in modules/
acquia_contenthub_subscriber/ src/ EventSubscriber/ LoadLocalEntity/ LoadMatchingRedirect.php
File
- src/
Event/ LoadLocalEntityEvent.php, line 18
Namespace
Drupal\acquia_contenthub\EventView source
class LoadLocalEntityEvent extends Event {
/**
* The CDF object.
*
* @var \Acquia\ContentHubClient\CDF\CDFObject
*/
protected $cdf;
/**
* The dependency stack.
*
* @var \Drupal\depcalc\DependencyStack
*/
protected $stack;
/**
* The local entity object.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
protected $entity;
/**
* LoadLocalEntityEvent constructor.
*
* @param \Acquia\ContentHubClient\CDF\CDFObject $cdf
* The CDF object for which to attempt to load a local entity.
* @param \Drupal\depcalc\DependencyStack $stack
* The dependency stack from which to extract related entity data.
*/
public function __construct(CDFObject $cdf, DependencyStack $stack) {
$this->cdf = $cdf;
$this->stack = $stack;
}
/**
* Get the CDF Object.
*
* @return \Acquia\ContentHubClient\CDF\CDFObject
* The CDF object.
*/
public function getCdf() : CDFObject {
return $this->cdf;
}
/**
* Get the dependency stack.
*
* @return \Drupal\depcalc\DependencyStack
* The Dependency Stack.
*/
public function getStack() : DependencyStack {
return $this->stack;
}
/**
* Gets the local entity.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity object.
*/
public function getEntity() {
return $this->entity;
}
/**
* Checks whether it has an entity.
*
* @return bool
* TRUE if it has an entity, FALSE otherwise.
*/
public function hasEntity() {
return (bool) $this->entity;
}
/**
* Set the entity that was loaded and add it to the stack.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
*
* @throws \Exception
*/
public function setEntity(EntityInterface $entity) : void {
$wrapper = new DependentEntityWrapper($entity);
$wrapper
->setRemoteUuid($this
->getCdf()
->getUuid());
$this->stack
->addDependency($wrapper);
$this->entity = $entity;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LoadLocalEntityEvent:: |
protected | property | The CDF object. | |
LoadLocalEntityEvent:: |
protected | property | The local entity object. | |
LoadLocalEntityEvent:: |
protected | property | The dependency stack. | |
LoadLocalEntityEvent:: |
public | function | Get the CDF Object. | |
LoadLocalEntityEvent:: |
public | function | Gets the local entity. | |
LoadLocalEntityEvent:: |
public | function | Get the dependency stack. | |
LoadLocalEntityEvent:: |
public | function | Checks whether it has an entity. | |
LoadLocalEntityEvent:: |
public | function | Set the entity that was loaded and add it to the stack. | |
LoadLocalEntityEvent:: |
public | function | LoadLocalEntityEvent constructor. |