Methods |
public
static
|
getContextualBindings(): array
Get a dependency substitution map for the provider
Get a dependency substitution map for the provider
{@inheritDoc}
Override this method to bind any {@see SyncEntityInterface} classes
customised for the provider to their generic parent classes, e.g.:
<?php
public static function getContextualBindings(): array
{
return [
Post::class => CustomPost::class,
User::class => CustomUser::class,
];
}
Implements
|
#
|
public
|
__construct(ContainerInterface $app, SyncStoreInterface $store)
Creates a new sync provider object
Creates a new sync provider object
Creating an instance of the provider registers it with the entity store
injected by the container.
Overrides
|
#
|
public
|
getContext(): SyncContextInterface
Get a context within which to instantiate entities on the provider's
behalf
Get a context within which to instantiate entities on the provider's
behalf
Overrides
Implements
|
#
|
public
|
getFilterPolicy(): ?int
Get the provider's default unclaimed filter policy
Get the provider's default unclaimed filter policy
Implements
|
#
|
public
|
isValidIdentifier($id, string $entity): bool
True if a value is of the correct type and format to be an entity ID
True if a value is of the correct type and format to be an entity ID
Implements
|
#
|
final
public
|
getStore(): SyncStoreInterface
Get the provider's entity store
Get the provider's entity store
Implements
|
#
|
final
public
|
getProviderId(): int
Get the provider ID assigned to the backend instance by its entity store
Get the provider ID assigned to the backend instance by its entity store
Implements
|
#
|
protected
|
run<T is SyncEntityInterface, TOutput is iterable<T>|T>(
SyncContextInterface $context,
Closure(): TOutput $operation,
): TOutput
Perform a sync operation if its context is valid
Perform a sync operation if its context is valid
Providers where sync operations are performed by declared methods should
use this method to ensure filter policy violations are caught and to take
advantage of other safety checks that may be added in the future.
Example:
<?php
class Provider extends HttpSyncProvider
{
public function getEntities(SyncContextInterface $ctx): iterable
{
// Claim filter values
$start = $ctx->claimFilter('start_date');
$end = $ctx->claimFilter('end_date');
return $this->run(
$ctx,
fn(): iterable =>
Entity::provide(
$this->getCurler('/entities')->getP([
'from' => $start,
'to' => $end,
]),
$this,
$ctx,
)
);
}
}
|
#
|
protected
|
pipelineFrom<T is SyncEntityInterface>(class-string<T> $entity): PipelineInterface<mixed[], T, SyncPipelineArgument>
Get a new pipeline for mapping provider data to entities
Get a new pipeline for mapping provider data to entities
|
#
|
protected
|
pipelineTo<T is SyncEntityInterface>(class-string<T> $entity): PipelineInterface<T, mixed[], SyncPipelineArgument>
Get a new pipeline for mapping entities to provider data
Get a new pipeline for mapping entities to provider data
|
#
|
final
public
static
|
getServices(): array
Get a list of services provided by the class
Get a list of services provided by the class
Implements
|
#
|
final
public
|
with<TEntity is SyncEntityInterface>(
class-string<TEntity> $entity,
?SyncContextInterface $context = null,
): SyncEntityProvider<TEntity, static>
Use an entity-agnostic interface to the provider's implementation of sync
operations for an entity
Use an entity-agnostic interface to the provider's implementation of sync
operations for an entity
Implements
|
#
|
final
public
|
runOperation<T, TOutput is iterable<T>|T>(SyncContextInterface $context, Closure(): TOutput $operation): TOutput
Perform a sync operation after validating its context
Perform a sync operation after validating its context
Implements
|
#
|
final
public
|
filterOperationOutput(SyncContextInterface $context, $output)
Filter the output of a sync operation if required by its context
Filter the output of a sync operation if required by its context
Implements
|
#
|
final
public
|
__call(string $name, mixed[] $arguments): mixed
|
#
|