CommentStorage.php in Multiversion 8
File
src/Entity/Storage/Sql/CommentStorage.php
View source
<?php
namespace Drupal\multiversion\Entity\Storage\Sql;
use Drupal\multiversion\Entity\Storage\ContentEntityStorageInterface;
use Drupal\multiversion\Entity\Storage\ContentEntityStorageTrait;
use Drupal\comment\CommentStorage as CoreCommentStorage;
class CommentStorage extends CoreCommentStorage implements ContentEntityStorageInterface {
use ContentEntityStorageTrait {
delete as deleteEntities;
}
public function delete(array $entities) {
$keyed_entities = [];
foreach ($entities as $entity) {
$keyed_entities[$entity
->id()] = $entity;
}
if (!empty($keyed_entities)) {
$child_cids = $this
->getChildCids($keyed_entities);
while (!empty($child_cids)) {
$child_entities = $this
->loadMultiple($child_cids);
$keyed_entities = $keyed_entities + $child_entities;
$child_cids = $this
->getChildCids($child_entities);
}
}
krsort($keyed_entities);
$this
->deleteEntities($keyed_entities);
}
}