You are here

private function RedirectSubscriber::getActiveUserRevisionData in Data Policy 8

Get active user revision data from the database.

Parameters

bool $return_query: True if the query should re returned instead of query result.

Return value

\Drupal\Core\Database\Query\SelectInterface|array

1 call to RedirectSubscriber::getActiveUserRevisionData()
RedirectSubscriber::checkForRedirection in src/RedirectSubscriber.php
This method is called when the KernelEvents::REQUEST event is dispatched.

File

src/RedirectSubscriber.php, line 340

Class

RedirectSubscriber
Class RedirectSubscriber.

Namespace

Drupal\data_policy

Code

private function getActiveUserRevisionData($return_query = FALSE) {
  $query = $this->database
    ->select('user_consent', 'uc');
  $query
    ->condition('status', TRUE);
  $query
    ->condition('user_id', $this->currentUser
    ->id());
  $query
    ->join('user_consent__data_policy_revision_id', 'ucr', 'uc.id = ucr.entity_id');
  $query
    ->addField('uc', 'required');
  $query
    ->addField('ucr', 'data_policy_revision_id_value');
  if ($return_query) {
    return $query;
  }
  return $query
    ->execute()
    ->fetchAll(\PDO::FETCH_ASSOC);
}