Returns EntityInfo for a given table name with prefix (e.g., "wp_posts" or "wp_commentmeta")
public getEntityInfoByPrefixedTableName ( $tableName ) : |
||
$tableName | ||
return |
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); } }
/** * Returns entity name for a table * * @param DbSchemaInfo $schema * @param string $table * @return mixed */ private function resolveEntityName($schema, $table) { $entity = $schema->getEntityInfoByPrefixedTableName($table); return $entity == null ? $schema->trimPrefix($table) : $entity->entityName; }