-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The Storage package needs a storage interface that can have Readable, Modifiable and other storage types plugged into it.
This would allow for behaviour like so:
$storage = new Storage([
'create' => new SomeCreatableStorage(),
'read' => new SomeReadableStorage(),
'modify' => new SomeModifiableStorage()
]);
$storage->readFrom(new SomeOtherReadableStorage());
$storage->searchFrom(new SomeSearchableStorage());
if (!$storage->canRead()) {
throw new \RuntimeException('Storage is not readable!');
}Perhaps by default the storage could assume everything capable from a single source, too:
$storage = new Storage(new DatabaseStorage($connection));Sources could then be overridden afterwards if need be.
Maybe this needs a different name too, this is basically like a MultiStorage adapter. Or maybe the source interfaces should be renamed.
Work this out into a perfect set of interfaces and this will be one hell of an expressive system.