1

I am trying to Query all paragraphs of a certain type but I am not getting any output. Is my query right? Currently being returned an empty array.

$query = $this->node->getQuery()
          ->condition('type', 'my_paragraph_type')
          ->execute();
        $this->logger->info('query: ' . json_encode($query));
J. E
  • 413
  • 1
  • 6
  • 12
  • Can you also explain what instance of class does $this represents? And I am just being curious, where did you get this code? :) – zanvidmar Mar 05 '19 at 00:13
  • sorry for hijacking this post for a sec - @j-e - deleting your [question](https://stackoverflow.com/q/55482713/5221944) after you got answer is not good practice here on SO. if you will reconsider your decision on this and undelete it - I will have chance to explain you why my answer helped you – Mikhail Berlyant Apr 02 '19 at 20:26

1 Answers1

2

Try with entityQuery('entity_type')

$pids = \Drupal::entityQuery('paragraph')
  ->condition('type', 'my_paragraph_type')
  ->execute();
zanvidmar
  • 361
  • 4
  • 13