3

I've created a Media type called "ad_gallery" can I can't seem to pull in all the entries while preprocessing.

I'm trying

\Drupal::entityQuery('media')->condition('type','ad_gallery')->execute();

And it's saying:

Drupal\Core\Entity\Query\QueryException: 'type' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable()

Is there a different way to query these than there is nodes?

Devar-TTY
  • 476
  • 5
  • 22

1 Answers1

3

You should use bundle instead of type.

Something like this will do the trick:

\Drupal::entityQuery('media')->condition('bundle', 'ad_gallery')->execute();
anpel
  • 931
  • 6
  • 16