Methods |
abstract
protected
|
getClosure(SyncOperation::* $operation): (Closure(SyncContextInterface, mixed...): (iterable<TEntity>|TEntity))|null
Get a closure to perform a sync operation on the entity
Get a closure to perform a sync operation on the entity
This method is called if:
- the operation is in {@see AbstractSyncDefinition::$Operations},
- there is no override for the operation, and
- the provider has not implemented the operation via a declared method
Implemented by
|
#
|
public
|
__construct(
class-string<TEntity> $entity,
TProvider $provider,
array<SyncOperation::*> $operations = [],
ListConformity::* $conformity = ListConformity::NONE,
FilterPolicy::*|null $filterPolicy = null,
array<int-mask-of<SyncOperation::*>, OverrideClosure> $overrides = [],
array<array-key, array-key|array-key[]>|null $keyMap = null,
int-mask-of<ArrayMapperInterface::*> $keyMapFlags = ArrayMapperInterface::ADD_UNMAPPED,
PipelineInterface<mixed[], TEntity, SyncPipelineArgument>|null $pipelineFromBackend = null,
PipelineInterface<TEntity, mixed[], SyncPipelineArgument>|null $pipelineToBackend = null,
bool $readFromList = false,
EntitySource::*|null $returnEntitiesFrom = null,
)
|
#
|
final
public
|
withConformity(ListConformity::* $conformity): static
Get an instance with the given entity data conformity level
Get an instance with the given entity data conformity level
|
#
|
final
public
|
withFilterPolicy(FilterPolicy::* $policy): static
Get an instance with the given unclaimed filter policy
Get an instance with the given unclaimed filter policy
|
#
|
final
public
|
withKeyMap(array<array-key, array-key|array-key[]>|null $map): static
Get an instance that maps keys to the given properties for entity data
returned by the provider
Get an instance that maps keys to the given properties for entity data
returned by the provider
|
#
|
final
public
|
withKeyMapFlags(int-mask-of<ArrayMapperInterface::*> $flags): static
Get an instance where the given array mapper flags are used if a key map
is provided
Get an instance where the given array mapper flags are used if a key map
is provided
|
#
|
final
public
|
withPipelineFromBackend(PipelineInterface<mixed[], TEntity, SyncPipelineArgument>|null $pipeline): static
Get an instance that uses the given pipeline to map provider data to a
serialized entity
Get an instance that uses the given pipeline to map provider data to a
serialized entity
|
#
|
final
public
|
withPipelineToBackend(PipelineInterface<TEntity, mixed[], SyncPipelineArgument>|null $pipeline): static
Get an instance that uses the given pipeline to map a serialized entity
to provider data
Get an instance that uses the given pipeline to map a serialized entity
to provider data
|
#
|
final
public
|
withReadFromList(bool $readFromList = true): static
Get an instance that performs READ operations by iterating over entities
returned by READ_LIST
Get an instance that performs READ operations by iterating over entities
returned by READ_LIST
|
#
|
final
public
|
withReturnEntitiesFrom(EntitySource::*|null $source): static
Get an instance that uses the given entity data source for the return
value of a successful CREATE, UPDATE or DELETE…
Get an instance that uses the given entity data source for the return
value of a successful CREATE, UPDATE or DELETE operation
|
#
|
final
public
|
getOperationClosure(int $operation): ?Closure
Get a closure to perform a sync operation on the entity, or null if the
operation is not supported
Get a closure to perform a sync operation on the entity, or null if the
operation is not supported
Implements
|
#
|
final
public
|
getFallbackClosure(
SyncOperation::* $operation,
): ($operation is SyncOperation::READ ? Closure(SyncContextInterface, int|string|null, mixed...): TEntity : ($operation is SyncOperation::READ_LIST ? Closure(SyncContextInterface, mixed...): iterable<TEntity> : ($operation is SyncOperation::CREATE|SyncOperation::UPDATE|SyncOperation::DELETE ? Closure(SyncContextInterface, TEntity, mixed...): TEntity : Closure(SyncContextInterface, iterable<TEntity>, mixed...): iterable<TEntity>)))
Ignoring overrides, get a closure to perform a sync operation on the
entity, throwing an exception if the operation is…
Ignoring overrides, get a closure to perform a sync operation on the
entity, throwing an exception if the operation is not supported
Throws
|
#
|
final
protected
|
getPipelineToBackend(): PipelineInterface<TEntity, mixed[], SyncPipelineArgument>
Get an entity-to-data pipeline for the entity
Get an entity-to-data pipeline for the entity
Before returning the pipeline:
- a pipe that serializes any unserialized {@see SyncEntityInterface}
instances is added via {@see PipelineInterface::through()}
|
#
|
final
protected
|
getPipelineFromBackend(): PipelineInterface<mixed[], TEntity, SyncPipelineArgument>
Get a data-to-entity pipeline for the entity
Get a data-to-entity pipeline for the entity
Before returning the pipeline:
- if the definition has a key map, it is applied via
{@see PipelineInterface::throughKeyMap()}
- a closure to create instances of the entity from arrays returned by the
pipeline is applied via {@see PipelineInterface::then()}
|
#
|
public
static
|
getReadableProperties(): array
Get readable properties
Get readable properties
If ["*"] is returned, all protected properties are readable.
Overriden by
Implements
|
#
|
Properties |
public
readonly
|
class-string<TEntity>
|
$Entity
The entity being serviced
The entity being serviced
|
#
|
public
readonly
|
TProvider
|
$Provider
The provider servicing the entity
The provider servicing the entity
|
#
|
public
readonly
|
array<SyncOperation::*>
|
$Operations
Supported sync operations
Supported sync operations
|
#
|
public
readonly
|
ListConformity::*
|
$Conformity
Conformity level of data returned by the provider for this entity
Conformity level of data returned by the provider for this entity
|
#
|
public
readonly
|
FilterPolicy::*
|
$FilterPolicy
Action to take when filters are not claimed by the provider
Action to take when filters are not claimed by the provider
|
#
|
public
readonly
|
array<SyncOperation::*, Closure(SyncDefinitionInterface<TEntity, TProvider>, SyncOperation::*, SyncContextInterface, mixed...): (iterable<TEntity>|TEntity)>
|
$Overrides
Array that maps sync operations to closures that override other implementations
Array that maps sync operations to closures that override other implementations
|
#
|
public
readonly
|
array<array-key, array-key|array-key[]>|null
|
$KeyMap
Array that maps keys to properties for entity data returned by the provider
Array that maps keys to properties for entity data returned by the provider
|
#
|
public
readonly
|
int-mask-of<ArrayMapperInterface::*>
|
$KeyMapFlags
Array mapper flags used if a key map is provided
Array mapper flags used if a key map is provided
|
#
|
public
readonly
|
PipelineInterface<mixed[], TEntity, SyncPipelineArgument>|null
|
$PipelineFromBackend
Pipeline that maps provider data to a serialized entity, or `null` if mapping is not required
Pipeline that maps provider data to a serialized entity, or null if mapping is not required
|
#
|
public
readonly
|
PipelineInterface<TEntity, mixed[], SyncPipelineArgument>|null
|
$PipelineToBackend
Pipeline that maps a serialized entity to provider data, or `null` if mapping is not required
Pipeline that maps a serialized entity to provider data, or null if mapping is not required
|
#
|
public
readonly
|
bool
|
$ReadFromList
Perform READ operations by iterating over entities returned by READ_LIST
Perform READ operations by iterating over entities returned by READ_LIST
|
#
|
public
readonly
|
EntitySource::*|null
|
$ReturnEntitiesFrom
Source of entity data for the return value of a successful CREATE, UPDATE or DELETE operation
Source of entity data for the return value of a successful CREATE, UPDATE or DELETE operation
|
#
|
protected
|
ReflectionSyncEntity<TEntity>
|
$EntityReflector
|
#
|
protected
|
ReflectionSyncProvider<TProvider>
|
$ProviderReflector
|
#
|