PHP Класс VersionPress\Database\EntityInfo

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cleanCache
$entityName string Name of the entity, e.g. 'post' or 'comment'.
$hasNaturalVpid boolean If the entity has natural VPID, the $idColumnName and $vpidColumnName will point to the same column. The opposite is $usesGeneratedVpids.
$hasReferences boolean True if entity has references. Basically returns count($references) > 0.
$idColumnName string Name of a column that uniquely identifies the entity within a db table. This is most commonly an auto-increment primary key but not always - e.g., options use the 'option_name' which is not a primary key in that table but is a local id as far as VersionPress is concerned.
$mnReferences array The key is composed from table name and column in the junction table. This kind of relationship has to be described in both entities. Post: array( 'term_taxonomy.term_taxonomy_id' => 'term_taxonomy', ) Term taxonomy: array( 'term_taxonomy.object_id' => 'post', )
$parentReference string If entity is child entity (meta, term_taxonomy etc.), this contains name of reference to its parent.
$references array array( 'post_author' => 'user', 'post_parent' => 'post' ) If the entity doesn't have references, returns empty array.
$storageClass
$tableName string Name of DB table where the entity is stored. By default it's {@see entityName}.
$usesGeneratedVpids boolean The opposite is $hasNaturalVpid.
$valueReferences array The key consists of name of column, where reference source is stored with its value and column, where is name of referenced entities. array( 'meta_key=_thumbnail_id@meta_value' => 'post', 'meta_key=menu_object_item_id@meta_value' => 'post', )
$vpidColumnName string Name of a column that stores a globally unique VersionPress ID (VPID). For entities that use auto-increment $idColumnName this will be 'vp_id' and VersionPress will generate and maintain VPIDs for such entities. The opposite example is the options entity - the 'option_name' column already identifies the option globally and uniquely so it can be this VPID column name directly.

Открытые методы

Метод Описание
__construct ( array $entitySchema ) Does the parsing and sets all properties
getIgnoredColumns ( )
getReferencedEntities ( ) : array Returns list of referenced entities.
getRulesAndIntervalsForFrequentlyWrittenEntities ( )
getRulesForIgnoredEntities ( )
isFrequentlyWrittenEntity ( $entity )
isIgnoredEntity ( $entity )
isVirtualReference ( $reference )

Описание методов

__construct() публичный Метод

Does the parsing and sets all properties
public __construct ( array $entitySchema )
$entitySchema array Example: array('post' => array( 'table' => 'posts', 'id' => 'ID', 'references' => array ( 'post_author' => 'user' ) ))

getIgnoredColumns() публичный Метод

public getIgnoredColumns ( )

getReferencedEntities() публичный Метод

Returns list of referenced entities.
public getReferencedEntities ( ) : array
Результат array

getRulesAndIntervalsForFrequentlyWrittenEntities() публичный Метод

getRulesForIgnoredEntities() публичный Метод

isFrequentlyWrittenEntity() публичный Метод

public isFrequentlyWrittenEntity ( $entity )

isIgnoredEntity() публичный Метод

public isIgnoredEntity ( $entity )

isVirtualReference() публичный Метод

public isVirtualReference ( $reference )

Описание свойств

$cleanCache публичное свойство

public $cleanCache

$entityName публичное свойство

Name of the entity, e.g. 'post' or 'comment'.
public string $entityName
Результат string

$hasNaturalVpid публичное свойство

If the entity has natural VPID, the $idColumnName and $vpidColumnName will point to the same column. The opposite is $usesGeneratedVpids.
public bool $hasNaturalVpid
Результат boolean

$hasReferences публичное свойство

True if entity has references. Basically returns count($references) > 0.
public bool $hasReferences
Результат boolean

$idColumnName публичное свойство

Name of a column that uniquely identifies the entity within a db table. This is most commonly an auto-increment primary key but not always - e.g., options use the 'option_name' which is not a primary key in that table but is a local id as far as VersionPress is concerned.
public string $idColumnName
Результат string

$mnReferences публичное свойство

The key is composed from table name and column in the junction table. This kind of relationship has to be described in both entities. Post: array( 'term_taxonomy.term_taxonomy_id' => 'term_taxonomy', ) Term taxonomy: array( 'term_taxonomy.object_id' => 'post', )
public array $mnReferences
Результат array

$parentReference публичное свойство

If entity is child entity (meta, term_taxonomy etc.), this contains name of reference to its parent.
public string $parentReference
Результат string

$references публичное свойство

array( 'post_author' => 'user', 'post_parent' => 'post' ) If the entity doesn't have references, returns empty array.
public array $references
Результат array

$storageClass публичное свойство

public $storageClass

$tableName публичное свойство

Name of DB table where the entity is stored. By default it's {@see entityName}.
public string $tableName
Результат string

$usesGeneratedVpids публичное свойство

The opposite is $hasNaturalVpid.
public bool $usesGeneratedVpids
Результат boolean

$valueReferences публичное свойство

The key consists of name of column, where reference source is stored with its value and column, where is name of referenced entities. array( 'meta_key=_thumbnail_id@meta_value' => 'post', 'meta_key=menu_object_item_id@meta_value' => 'post', )
public array $valueReferences
Результат array

$vpidColumnName публичное свойство

Name of a column that stores a globally unique VersionPress ID (VPID). For entities that use auto-increment $idColumnName this will be 'vp_id' and VersionPress will generate and maintain VPIDs for such entities. The opposite example is the options entity - the 'option_name' column already identifies the option globally and uniquely so it can be this VPID column name directly.
public string $vpidColumnName
Результат string