You are here

protected function EntityCdfSerializer::getEntityFromCdf in Acquia Content Hub 8.2

Dispatches events to get entity from CDF object.

Parameters

\Acquia\ContentHubClient\CDF\CDFObject $entity_data: The CDF object.

\Drupal\depcalc\DependencyStack $stack: The dependency stack.

Return value

\Drupal\Core\Entity\EntityInterface Then entity from the CDF.

1 call to EntityCdfSerializer::getEntityFromCdf()
EntityCdfSerializer::processCdf in src/EntityCdfSerializer.php
Processes incoming CDF.

File

src/EntityCdfSerializer.php, line 368

Class

EntityCdfSerializer
Serialize an entity to a CDF format.

Namespace

Drupal\acquia_contenthub

Code

protected function getEntityFromCdf(CDFObject $entity_data, DependencyStack $stack) : ?EntityInterface {
  $load_local_entity_event = new LoadLocalEntityEvent($entity_data, $stack);
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::LOAD_LOCAL_ENTITY, $load_local_entity_event);
  $parse_cdf_event = new ParseCdfEntityEvent($entity_data, $stack, $load_local_entity_event
    ->getEntity());
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::PARSE_CDF, $parse_cdf_event);
  return $parse_cdf_event
    ->getEntity() ?? NULL;
}