我已经创建了一个名为“ad_gallery”的媒体类型,我似乎无法在预处理时提取所有条目。
我在努力
\Drupal::entityQuery('media')->condition('type','ad_gallery')->execute();
它在说:
Drupal\Core\Entity\Query\QueryException: 'type' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable()
是否有不同于节点的查询方式?
最佳答案
您应该使用bundle
而不是type
。
像这样的东西就可以了:
\Drupal::entityQuery('media')->condition('bundle', 'ad_gallery')->execute();
关于drupal-8 - 如何按类型查询 Drupal 8 Media?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54082520/