protected function ImportQueueResolver::getEntity in Content Synchronization 8.2
Same name and namespace in other branches
- 3.0.x src/DependencyResolver/ImportQueueResolver.php \Drupal\content_sync\DependencyResolver\ImportQueueResolver::getEntity()
Gets an entity.
Parameters
$identifier: An entity identifier to process.
$normalized_entities: An array of entity identifiers to process.
Return value
bool|mixed Decoded entity or FALSE if an entity already exists and doesn't require to be imported.
Throws
\Exception
1 call to ImportQueueResolver::getEntity()
- ImportQueueResolver::depthFirstSearch in src/
DependencyResolver/ ImportQueueResolver.php - Builds a graph placing the deepest vertexes at the first place.
File
- src/
DependencyResolver/ ImportQueueResolver.php, line 77
Class
- ImportQueueResolver
- Class ImportQueueResolver.
Namespace
Drupal\content_sync\DependencyResolverCode
protected function getEntity($identifier, $normalized_entities) {
if (!empty($normalized_entities[$identifier])) {
$entity = $normalized_entities[$identifier];
}
else {
list($entity_type_id, $bundle, $uuid) = explode('.', $identifier);
$file_path = content_sync_get_content_directory('sync') . "/entities/" . $entity_type_id . "/" . $bundle . "/" . $identifier . ".yml";
$raw_entity = file_get_contents($file_path);
// Problems to open the .yml file.
if (!$raw_entity) {
throw new \Exception("Dependency {$identifier} is missing.");
}
$entity = Yaml::decode($raw_entity);
}
return $entity;
}