Which is an efficient way to fetch entity label and id? Database query or entity query with entity load?
I need to get the list of all taxonomy terms in an associative array of
Label. I can do it loading the tree but the vocabulary has ~650 terms in it. So, loading the all the 650 terms and then building an array out of it seems like overkill.
I went with the static
\Drupal::database->query() route to get the result and cache the resulting array. Just wondering if it's the right or the Drupal way of doing it.