查询段落类型Drupal 8



我正在尝试查询某种类型的所有段落,但我没有得到任何输出。我的查询对吗?目前正在返回一个空数组。

$query = $this->node->getQuery()
          ->condition('type', 'my_paragraph_type')
          ->execute();
        $this->logger->info('query: ' . json_encode($query));

尝试使用entityquery('entity_type')

$pids = Drupal::entityQuery('paragraph')
  ->condition('type', 'my_paragraph_type')
  ->execute();

相关内容

最新更新