StorageAdapterFactory

Read onlyYes
FinalYes

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.

Internal

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

getAdapterByType()

Get adapter by type identifier

public getAdapterByType(string $typeIdentifier) : StorageAdapterInterface
Parameters
$typeIdentifier : string

Type identifier (e.g., 'extension', 'filemount')

Tags
throws
InvalidArgumentException

if no adapter with this type identifier exists

Return values
StorageAdapterInterface

getAdapterForIdentifier()

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
throws
RuntimeException

if no adapter can handle the identifier

Return values
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
Return values
bool

        
On this page

Search results