Writing own storage: Difference between revisions

From Sunhill Framework Documentation
+ Standard storages
removed method that are deleted upstream
Line 25: Line 25:
=== doSetIndexedValue(string $name, $index, $value) ===
=== doSetIndexedValue(string $name, $index, $value) ===
Sets in the array property $name the element identified by $index with $value
Sets in the array property $name the element identified by $index with $value
=== isDirty(): bool ===
Returns if the storage was modified.
=== doCommit() ===
For cached storages performs the flush of the cache. Has to be called by property.
   
=== doRollback() ===
For cached storages performs the reollback of the cache. Has to be called by property.


=== doGetIsInitialized(string $name): bool ===
=== doGetIsInitialized(string $name): bool ===
Line 39: Line 30:


== Optional methods ==
== 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) ===
=== prepareGetValue(string $name) ===

Revision as of 16:18, 11 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