protected function EntityCdfSerializer::handleImportFailure in Acquia Content Hub 8.2
Handles import failure.
Parameters
int $count: The previous count from the dependency stack.
\Acquia\ContentHubClient\CDFDocument $cdf: The CDF document.
\Drupal\depcalc\DependencyStack $stack: The dependency stack.
Throws
\Exception
1 call to EntityCdfSerializer::handleImportFailure()
- EntityCdfSerializer::unserializeEntities in src/
EntityCdfSerializer.php - Unserializes a CDF into a list of Drupal entities.
File
- src/
EntityCdfSerializer.php, line 431
Class
- EntityCdfSerializer
- Serialize an entity to a CDF format.
Namespace
Drupal\acquia_contenthubCode
protected function handleImportFailure(int $count, CDFDocument $cdf, DependencyStack $stack) {
$import_failed = $count === count($stack
->getDependencies()) && $count < count($cdf
->getEntities());
if (!$import_failed) {
return;
}
// @todo get import failure logging and tracking working.
$failed_import_event = new FailedImportEvent($cdf, $stack, $count, $this);
$this->dispatcher
->dispatch(AcquiaContentHubEvents::IMPORT_FAILURE, $failed_import_event);
if ($failed_import_event
->hasException()) {
$this->tracker
->cleanUp(TRUE);
throw $failed_import_event
->getException();
}
}