Writing own storage: Difference between revisions

From Sunhill Framework Documentation
+ PersistentStorage
+PersistentPoolStorage
Line 2: Line 2:
* [[SimpleStorage]]
* [[SimpleStorage]]
* [[PersistentStorage]]
* [[PersistentStorage]]
* [[PersistentPoolStorage]]


If you can't use one of the above you have to overwrite the following abstract methods
If you can't use one of the above you have to overwrite the following abstract methods
Line 42: Line 43:
=== postprocessSetValue(string $name, $value) ===
=== postprocessSetValue(string $name, $value) ===
Perfoms action after setting the value
Perfoms action after setting the value
 
 
[[Category:Storages]]
[[Category:Storages]]
[[Category:Properties]]
[[Category:Properties]]

Revision as of 08:35, 17 October 2024

When writing your own storage first check if you can use on of these storages as a base:

If you can't use one of the above you have to overwrite the following abstract methods

Abstract methods

doGetValue(string $name)

Performs the retrievement of the value.

doGetIndexedValue(string $name, mixed $index): mixed

Gets from the array element $name the entry identified by $index Note: This routine does not check, if the element is an array at all. This has do be done by the owning property

doGetElementCount(string $name): int

Gets from the array element $name the count of entries. Note: This routine does not check, if the element is an array at all. This has do be done by the owning property

doGetOffsetExists(string $name, $index): bool

Returns how many entries the array element has. Note: '

doSetValue(string $name, $value)

Performs the setting of the value

doSetIndexedValue(string $name, $index, $value)

Sets in the array property $name the element identified by $index with $value

doGetIsInitialized(string $name): bool

Returns if this storage was initialized

Optional methods

isDirty(): bool

Returns if the storage was modified. Overwrite when storage is writeable and can be modified. (for persistant storage use Persistant storage).

prepareGetValue(string $name)

Prepares the retrievement of the value

doGetKeys(string $name): array

postprocessSetValue(string $name, $value)

Perfoms action after setting the value