private function ImportEntityManager::importRemoteEntityDependencies in Acquia Content Hub 8
Saves the current Drupal Entity and all its dependencies.
This method is not to be used alone but to be used from importRemoteEntity() method, which is why it is private.
Parameters
\Drupal\acquia_contenthub\ContentHubEntityDependency $contenthub_entity: The Content Hub Entity.
array $dependencies: An array of ContentHubEntityDependency objects.
Return value
\Symfony\Component\HttpFoundation\JsonResponse|null The Drupal entity being created.
1 call to ImportEntityManager::importRemoteEntityDependencies()
- ImportEntityManager::importRemoteEntity in src/
ImportEntityManager.php - Saves a Content Hub Entity into a Drupal Entity, given its UUID.
File
- src/
ImportEntityManager.php, line 572
Class
- ImportEntityManager
- Provides a service for managing imported entities' actions.
Namespace
Drupal\acquia_contenthubCode
private function importRemoteEntityDependencies(ContentHubEntityDependency $contenthub_entity, array &$dependencies) {
// Create pre-dependencies.
foreach ($contenthub_entity
->getDependencyChain() as $uuid) {
$content_hub_entity_dependency = isset($dependencies[$uuid]) ? $dependencies[$uuid] : FALSE;
if ($content_hub_entity_dependency && !isset($content_hub_entity_dependency->__processed) && $content_hub_entity_dependency
->getRelationship() == ContentHubEntityDependency::RELATIONSHIP_INDEPENDENT) {
$dependencies[$uuid]->__processed = TRUE;
$this
->importRemoteEntityDependencies($content_hub_entity_dependency, $dependencies);
}
}
// Check already imported entity, that auto import is available or not.
$trackingEntity = $this->contentHubEntitiesTracking
->loadImportedByUuid($contenthub_entity
->getRawEntity()
->getUuid());
if ($trackingEntity && $trackingEntity
->isAutoUpdateDisabled()) {
return new JsonResponse(NULL);
}
// Now that we have created all its pre-dependencies, create the current
// Drupal entity.
$response = $this
->importRemoteEntityNoDependencies($contenthub_entity);
// Create post-dependencies.
foreach ($contenthub_entity
->getDependencyChain() as $uuid) {
$content_hub_entity_dependency = isset($dependencies[$uuid]) ? $dependencies[$uuid] : FALSE;
if ($content_hub_entity_dependency && !isset($content_hub_entity_dependency->__processed) && $content_hub_entity_dependency
->getRelationship() == ContentHubEntityDependency::RELATIONSHIP_DEPENDENT) {
$dependencies[$uuid]->__processed = TRUE;
$this
->importRemoteEntityDependencies($content_hub_entity_dependency, $dependencies);
}
}
return $response;
}