StorageAdapterFactory
Factory for finding storage adapters using Chain of Responsibility pattern
This factory manages storage adapters and finds the appropriate adapter for a given persistence identifier by asking each adapter if it can handle the identifier (via supports() method).
Adapters are checked in priority order (highest priority first), allowing extensions to provide custom adapters that override core adapters.
Table of Contents
Methods
- __construct() : mixed
- getAdapterByType() : StorageAdapterInterface
- Get adapter by type identifier
- getAdapterForIdentifier() : StorageAdapterInterface
- Get storage adapter that can handle the given persistence identifier
- getAllAdapters() : array<int, StorageAdapterInterface>
- Get all registered storage adapters
- getRegisteredTypeIdentifiers() : array<int, string>
- Get all registered storage type identifiers
- hasAdapterType() : bool
- Check if an adapter with the given type identifier exists
Methods
__construct()
public
__construct(iterable<string|int, StorageAdapterInterface> $adapters) : mixed
Parameters
- $adapters : iterable<string|int, StorageAdapterInterface>
getAdapterByType()
Get adapter by type identifier
public
getAdapterByType(string $typeIdentifier) : StorageAdapterInterface
Parameters
- $typeIdentifier : string
-
Type identifier (e.g., 'extension', 'filemount')
Tags
Return values
StorageAdapterInterfacegetAdapterForIdentifier()
Get storage adapter that can handle the given persistence identifier
public
getAdapterForIdentifier(string $identifier) : StorageAdapterInterface
Uses Chain of Responsibility pattern to find the first adapter (in priority order) that supports the given identifier.
Parameters
- $identifier : string
-
Persistence identifier (e.g., "EXT:my_ext/Forms/contact.form.yaml", "1:/forms/contact.form.yaml")
Tags
Return values
StorageAdapterInterfacegetAllAdapters()
Get all registered storage adapters
public
getAllAdapters() : array<int, StorageAdapterInterface>
Return values
array<int, StorageAdapterInterface>getRegisteredTypeIdentifiers()
Get all registered storage type identifiers
public
getRegisteredTypeIdentifiers() : array<int, string>
Return values
array<int, string>hasAdapterType()
Check if an adapter with the given type identifier exists
public
hasAdapterType(string $typeIdentifier) : bool
Parameters
- $typeIdentifier : string