0

I know how to load comment ids for a particular node by following code

$entity_manager = \Drupal::entityTypeManager();
$cids = $entity_manager
    ->getStorage('comment')
    ->getQuery('AND')
    ->condition('entity_id', '25364')
    ->condition('entity_type', 'node')
    ->execute();

But I need one more condition to add on because this node might have multiple comment type linked. I know the machine name , but I don't know exactly what should be the first parameter to be passed in condition.

1 Answer 1

0

I itself got the answer i just guessed the name to be passed in condition.

$cids = $entity_manager
    ->getStorage('comment')
    ->getQuery('AND')
    ->condition('entity_id', '25364')
    ->condition('entity_type', 'node')
    ->condition('comment_type' 'post_trp_comments')
    ->execute();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.