Commit be813993 authored by alexpott's avatar alexpott
Browse files

Issue #2291443 by marcingy: Convert comment_field_instance_config_delete query to entity query.

parent e7f8c6d7
......@@ -206,11 +206,11 @@ function comment_field_config_insert(FieldConfigInterface $field) {
function comment_field_instance_config_delete(FieldInstanceConfigInterface $instance) {
if ($instance->getType() == 'comment') {
// Delete all comments that used by the entity bundle.
$comments = db_query("SELECT cid FROM {comment} WHERE entity_type = :entity_type AND field_name = :field_name", array(
':entity_type' => $instance->getEntityTypeId(),
':field_name' => $instance->getName(),
entity_delete_multiple('comment', $comments);
$entity_query = \Drupal::entityQuery('comment');
$entity_query->condition('entity_type', $instance->getEntityTypeId());
$entity_query->condition('field_name', $instance->getName());
$cids = $entity_query->execute();
entity_delete_multiple('comment', $cids);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment