You are here

private function ContentHubEntitiesTracking::getFromOriginQuery in Acquia Content Hub 8

Produces a database query that matches an origin and status.

Parameters

string $origin: The origin UUID.

string $status_export: The Export Status.

string $status_import: The Import Status.

string $entity_type_id: The Entity type.

Return value

bool|\Drupal\Core\Database\Query\SelectInterface The Select Query or FALSE.

2 calls to ContentHubEntitiesTracking::getFromOriginQuery()
ContentHubEntitiesTracking::getFromOrigin in src/ContentHubEntitiesTracking.php
Lists all imported entities that match a certain origin and status.
ContentHubEntitiesTracking::getFromOriginCount in src/ContentHubEntitiesTracking.php
Obtains the number of entities that match a certain origin and status.

File

src/ContentHubEntitiesTracking.php, line 760

Class

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

Namespace

Drupal\acquia_contenthub

Code

private function getFromOriginQuery($origin, $status_export = '', $status_import = '', $entity_type_id = '') {
  if (Uuid::isValid($origin) && ($status_export xor $status_import)) {

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