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
Mostrar archivo Open project: versionpress/versionpress Class Usage Examples

Protected Properties

Property Type Description
$keyName
$valueName

Public Methods

Method 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 )

Protected Methods

Method 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

Method 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 method

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

commit() public method

public commit ( )

createChangeInfoWithParentEntity() protected method

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

createJoinedKey() protected method

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

delete() public method

public delete ( $restriction )

exists() public method

public exists ( $vpId, $parentId )

extractEntityFromParentByName() protected method

protected extractEntityFromParentByName ( $parentEntity, $name )

extractEntityFromParentByVpId() protected method

protected extractEntityFromParentByVpId ( $parentEntity, $vpId ) : array | null
$parentEntity
$vpId
return array | null

getEntityFilename() public method

public getEntityFilename ( $vpId, $parentId )

getPathCommonToAllEntities() public method

loadAll() public method

public loadAll ( )

loadEntity() public method

public loadEntity ( $id, $parentId )

loadEntityByName() public method

public loadEntityByName ( $name, $parentId )

prepareStorage() public method

public prepareStorage ( )

save() public method

public save ( $data )

saveLater() public method

public saveLater ( $data )

shouldBeSaved() public method

public shouldBeSaved ( $data )

splitJoinedKey() protected method

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
return array

Property Details

$keyName protected_oe property

protected $keyName

$valueName protected_oe property

protected $valueName