function delete($table, $where) { if ($this->disabled) { return; } $entityInfo = $this->dbSchemaInfo->getEntityInfoByPrefixedTableName($table); if (!$entityInfo) { return; } $entityName = $entityInfo->entityName; if (!$entityInfo->usesGeneratedVpids) { $this->mirror->delete($entityName, $where); return; } $ids = $this->detectAllAffectedIds($entityName, $where, $where); foreach ($ids as $id) { $where['vp_id'] = $this->vpidRepository->getVpidForEntity($entityName, $id); if (!$where['vp_id']) { continue; // already deleted - deleting postmeta is sometimes called twice } if ($this->dbSchemaInfo->isChildEntity($entityName) && !isset($where["vp_{$entityInfo->parentReference}"])) { $where = $this->fillParentId($entityName, $where, $id); } $this->vpidRepository->deleteId($entityName, $id); $this->mirror->delete($entityName, $where); } }