public function SubscriberAudit::findEntitiesToImport in Acquia Content Hub 8
Finds entities to import.
2 calls to SubscriberAudit::findEntitiesToImport()
- SubscriberAudit::generateManifest in acquia_contenthub_audit/
src/ SubscriberAudit.php - Generate Manifest file.
- SubscriberAudit::importEntities in acquia_contenthub_audit/
src/ SubscriberAudit.php - Import Entities.
File
- acquia_contenthub_audit/
src/ SubscriberAudit.php, line 124
Class
- SubscriberAudit
- Audits Subscribers.
Namespace
Drupal\acquia_contenthub_auditCode
public function findEntitiesToImport() {
$entities = $this->common
->executeAllFilters();
$map = $this->common
->getFilterMap();
unset($entities['total']);
$new_entities = [];
if ($entities) {
$origin = $this->configFactory
->get('acquia_contenthub.admin_settings')
->get('origin');
$uuids = array_keys($entities);
$query = $this->database
->select('acquia_contenthub_entities_tracking', 't')
->fields('t');
$query
->condition('t.entity_uuid', $uuids, 'IN');
$query
->condition('t.status_import', ContentHubEntitiesTracking::IS_DEPENDENT, '<>');
$query
->condition('t.status_import', ContentHubEntitiesTracking::HAS_LOCAL_CHANGE, '<>');
$query
->condition('t.status_import', '', '<>');
$query
->condition('t.origin', $origin, '<>');
$results = $query
->execute();
$existing_uuids = [];
foreach ($results as $item) {
$existing_uuids[$item->entity_uuid] = $item;
}
$new_uuids = array_diff($uuids, array_keys($existing_uuids));
if ($new_uuids) {
foreach ($new_uuids as $uuid) {
$new_entities[$uuid] = [
'entity' => $entities[$uuid],
'filter' => $map[$uuid],
];
}
}
}
return $new_entities;
}