VersionPress\Storages\Storage::save PHP Méthode

save() abstract public méthode

Saves data to a storage
abstract public save ( array $data ) : VersionPress\ChangeInfos\ChangeInfo | null
$data array Associative array with values to save. On `insert`, the $data will contain full entity data plus things like VPID. On further updates, the data will typically contain just the updated values and a VPID (assigned in {@link VersionPress\Database\WpdbMirrorBridge} so that the appropriate file could be located).
Résultat VersionPress\ChangeInfos\ChangeInfo | null Null indicates that the save operation didn't really change anything (may happen). Otherwise, the ChangeInfo object is returned.
    public abstract function save($data);

Usage Example

 public function delete($restriction)
 {
     $parentVpId = $restriction[$this->parentReferenceName];
     $parent = $this->parentStorage->loadEntity($parentVpId, null);
     $fieldToDelete = $this->getJoinedKeyByVpId($parent, $restriction['vp_id']);
     $oldEntity = $this->extractEntityFromParentByVpId($parent, $restriction['vp_id']);
     $oldParentEntity = $parent;
     $parent[$fieldToDelete] = false;
     // mark for deletion
     $newParentEntity = $parent;
     $this->parentStorage->save($parent);
     return $this->createChangeInfoWithParentEntity($oldEntity, $oldEntity, $oldParentEntity, $newParentEntity, 'delete');
 }
All Usage Examples Of VersionPress\Storages\Storage::save