You are here

public function TermHandler::getTidsBoundToAllNidsForPublishedNodes in Permissions by Term 8.2

File

src/Service/TermHandler.php, line 81

Class

TermHandler

Namespace

Drupal\permissions_by_term\Service

Code

public function getTidsBoundToAllNidsForPublishedNodes() : array {
  $query = $this->database
    ->select('taxonomy_index', 'ti')
    ->fields('ti', [
    'tid',
    'nid',
  ]);
  $nidToTids = [];
  $ret = $query
    ->execute()
    ->fetchAll();
  foreach ($ret as $returnObject) {
    $nidToTids[$returnObject->nid][] = $returnObject->tid;
  }
  return $nidToTids;
}