You are here

public function ContentHubEntitiesTracking::getImportedEntities in Acquia Content Hub 8

Database query that fetches entities based on type and status.

Parameters

string $status_import: The Import Status.

string $entity_type_id: The Entity type.

Return value

array Entities returned from the query.

File

src/ContentHubEntitiesTracking.php, line 791

Class

ContentHubEntitiesTracking
Tracks in a table the list of all entities imported from Content Hub.

Namespace

Drupal\acquia_contenthub

Code

public function getImportedEntities($status_import = '', $entity_type_id = '') {
  if ($status_import) {

    /** @var \Drupal\Core\Database\Query\SelectInterface $query */
    $query = $this->database
      ->select(self::TABLE, 'ci')
      ->fields('ci');
    $query = $query
      ->condition('status_import', $status_import);
    if (!empty($entity_type_id)) {
      $query = $query
        ->condition('entity_type', $entity_type_id);
    }
    return $query
      ->execute()
      ->fetchAll();
  }
  return [];
}