Commit 627470bc authored by webchick's avatar webchick
Browse files

Issue #2291445 by marcingy: Convert comment_entity_predelete query to entity query.

parent 5baeab76
......@@ -839,12 +839,10 @@ function comment_entity_predelete(EntityInterface $entity) {
// entity type that has an integer ID, $entity->id() might be a string
// containing a number), and then cast it to an integer when querying.
if ($entity->getEntityType()->isFieldable() && is_numeric($entity->id())) {
$cids = db_select('comment', 'c')
->fields('c', array('cid'))
->condition('entity_id', (int) $entity->id())
->condition('entity_type', $entity->getEntityTypeId())
$entity_query = \Drupal::entityQuery('comment');
$entity_query->condition('entity_id', (int) $entity->id());
$entity_query->condition('entity_type', $entity->getEntityTypeId());
$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