PHP Class VersionPress\Database\EntityInfo

Afficher le fichier Open project: versionpress/versionpress Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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 )

Method Details

__construct() public méthode

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 méthode

public getIgnoredColumns ( )

getReferencedEntities() public méthode

Returns list of referenced entities.
public getReferencedEntities ( ) : array
Résultat array

getRulesAndIntervalsForFrequentlyWrittenEntities() public méthode

getRulesForIgnoredEntities() public méthode

isFrequentlyWrittenEntity() public méthode

public isFrequentlyWrittenEntity ( $entity )

isIgnoredEntity() public méthode

public isIgnoredEntity ( $entity )

isVirtualReference() public méthode

public isVirtualReference ( $reference )

Property Details

$cleanCache public_oe property

public $cleanCache

$entityName public_oe property

Name of the entity, e.g. 'post' or 'comment'.
public string $entityName
Résultat string

$hasNaturalVpid public_oe property

If the entity has natural VPID, the $idColumnName and $vpidColumnName will point to the same column. The opposite is $usesGeneratedVpids.
public bool $hasNaturalVpid
Résultat boolean

$hasReferences public_oe property

True if entity has references. Basically returns count($references) > 0.
public bool $hasReferences
Résultat boolean

$idColumnName public_oe property

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
Résultat string

$mnReferences public_oe property

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
Résultat array

$parentReference public_oe property

If entity is child entity (meta, term_taxonomy etc.), this contains name of reference to its parent.
public string $parentReference
Résultat string

$references public_oe property

array( 'post_author' => 'user', 'post_parent' => 'post' ) If the entity doesn't have references, returns empty array.
public array $references
Résultat array

$storageClass public_oe property

public $storageClass

$tableName public_oe property

Name of DB table where the entity is stored. By default it's {@see entityName}.
public string $tableName
Résultat string

$usesGeneratedVpids public_oe property

The opposite is $hasNaturalVpid.
public bool $usesGeneratedVpids
Résultat boolean

$valueReferences public_oe property

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
Résultat array

$vpidColumnName public_oe property

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
Résultat string