PHP Class VersionPress\Storages\MetaEntityStorage

The MetaEntityStorage typically transforms the entity to the format metioned above and then saves it using parent storage as a field of the parent entity.
Inheritance: extends Storage
Afficher le fichier Open project: versionpress/versionpress Class Usage Examples

Protected Properties

Свойство Type Description
$keyName
$valueName

Méthodes publiques

Méthode Description
__construct ( Storage $parentStorage, EntityInfo $entityInfo, $dbPrefix, $changeInfoFactory, $keyName = 'meta_key', $valueName = 'meta_value' )
commit ( )
delete ( $restriction )
exists ( $vpId, $parentId )
getEntityFilename ( $vpId, $parentId )
getPathCommonToAllEntities ( )
loadAll ( )
loadEntity ( $id, $parentId )
loadEntityByName ( $name, $parentId )
prepareStorage ( )
save ( $data )
saveLater ( $data )
shouldBeSaved ( $data )

Méthodes protégées

Méthode Description
createChangeInfoWithParentEntity ( $oldEntity, $newEntity, $oldParentEntity, $newParentEntity, $action )
createJoinedKey ( $key, $vpId ) : string Returns $key#$vpId from $key and $vpId inputs.
extractEntityFromParentByName ( $parentEntity, $name )
extractEntityFromParentByVpId ( $parentEntity, $vpId ) : array | null
splitJoinedKey ( $key ) : array Splits joined key $key#$vpId into array.

Private Methods

Méthode Description
extractEntityFromParent ( $parentEntity, $joinedKey )
getJoinedKeyByName ( $parent, $name ) : string | null Finds a joined key with given VPID within the parent entity.
getJoinedKeyByVpId ( $parent, $vpId ) : string | null Finds a joined key with given VPID within the parent entity.
transformToParentEntityField ( $values )

Method Details

__construct() public méthode

public __construct ( Storage $parentStorage, EntityInfo $entityInfo, $dbPrefix, $changeInfoFactory, $keyName = 'meta_key', $valueName = 'meta_value' )
$parentStorage Storage
$entityInfo VersionPress\Database\EntityInfo

commit() public méthode

public commit ( )

createChangeInfoWithParentEntity() protected méthode

protected createChangeInfoWithParentEntity ( $oldEntity, $newEntity, $oldParentEntity, $newParentEntity, $action )

createJoinedKey() protected méthode

It's used in a parent entity file as key representing the entity.
protected createJoinedKey ( $key, $vpId ) : string
$key
$vpId
Résultat string

delete() public méthode

public delete ( $restriction )

exists() public méthode

public exists ( $vpId, $parentId )

extractEntityFromParentByName() protected méthode

protected extractEntityFromParentByName ( $parentEntity, $name )

extractEntityFromParentByVpId() protected méthode

protected extractEntityFromParentByVpId ( $parentEntity, $vpId ) : array | null
$parentEntity
$vpId
Résultat array | null

getEntityFilename() public méthode

public getEntityFilename ( $vpId, $parentId )

getPathCommonToAllEntities() public méthode

loadAll() public méthode

public loadAll ( )

loadEntity() public méthode

public loadEntity ( $id, $parentId )

loadEntityByName() public méthode

public loadEntityByName ( $name, $parentId )

prepareStorage() public méthode

public prepareStorage ( )

save() public méthode

public save ( $data )

saveLater() public méthode

public saveLater ( $data )

shouldBeSaved() public méthode

public shouldBeSaved ( $data )

splitJoinedKey() protected méthode

Example: Let the key name is "meta_key" and the input is "some-key#1234", then the output is array('meta_key' => 'some-key', 'vp_id' => '1234').
protected splitJoinedKey ( $key ) : array
$key
Résultat array

Property Details

$keyName protected_oe property

protected $keyName

$valueName protected_oe property

protected $valueName