VersionPress\Database\DbSchemaInfo::getEntityInfoByPrefixedTableName PHP Method

getEntityInfoByPrefixedTableName() public method

Returns EntityInfo for a given table name with prefix (e.g., "wp_posts" or "wp_commentmeta")
public getEntityInfoByPrefixedTableName ( $tableName ) : EntityInfo
$tableName
return EntityInfo
    public function getEntityInfoByPrefixedTableName($tableName)
    {
        $tableName = $this->trimPrefix($tableName);
        return $this->getEntityInfoByTableName($tableName);
    }

Usage Example

Example #1
0
 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);
     }
 }
All Usage Examples Of VersionPress\Database\DbSchemaInfo::getEntityInfoByPrefixedTableName