1: <?php declare(strict_types=1);
2:
3: namespace Salient\Sync\Db;
4:
5: use Salient\Contract\Core\Pipeline\PipelineInterface;
6: use Salient\Contract\Core\ArrayMapperFlag;
7: use Salient\Contract\Core\ListConformity;
8: use Salient\Contract\Sync\FilterPolicy;
9: use Salient\Contract\Sync\SyncContextInterface;
10: use Salient\Contract\Sync\SyncEntityInterface;
11: use Salient\Contract\Sync\SyncEntitySource;
12: use Salient\Contract\Sync\SyncOperation as OP;
13: use Salient\Core\AbstractBuilder;
14: use Salient\Sync\Support\SyncPipelineArgument;
15: use Salient\Sync\AbstractSyncDefinition;
16: use Closure;
17:
18: /**
19: * A fluent DbSyncDefinition factory
20: *
21: * @method $this operations(array<OP::*> $value) Supported sync operations
22: * @method $this table(?string $value) Set DbSyncDefinition::$Table
23: * @method $this conformity(ListConformity::* $value) Conformity level of data returned by the provider for this entity (see {@see AbstractSyncDefinition::$Conformity})
24: * @method $this filterPolicy(FilterPolicy::*|null $value) Action to take when filters are not claimed by the provider (see {@see AbstractSyncDefinition::$FilterPolicy})
25: * @method $this overrides(array<int-mask-of<OP::*>,Closure(DbSyncDefinition<TEntity,TProvider>, OP::*, SyncContextInterface, mixed...): (iterable<TEntity>|TEntity)> $value) Array that maps sync operations to closures that override other implementations (see {@see AbstractSyncDefinition::$Overrides})
26: * @method $this keyMap(array<array-key,array-key|array-key[]>|null $value) Array that maps keys to properties for entity data returned by the provider (see {@see AbstractSyncDefinition::$KeyMap})
27: * @method $this keyMapFlags(int-mask-of<ArrayMapperFlag::*> $value) Array mapper flags used if a key map is provided
28: * @method $this readFromList(bool $value = true) Perform READ operations by iterating over entities returned by READ_LIST (default: false; see {@see AbstractSyncDefinition::$ReadFromList})
29: * @method $this returnEntitiesFrom(SyncEntitySource::*|null $value) Source of entity data for the return value of a successful CREATE, UPDATE or DELETE operation
30: *
31: * @template TEntity of SyncEntityInterface
32: * @template TProvider of DbSyncProvider
33: *
34: * @extends AbstractBuilder<DbSyncDefinition<TEntity,TProvider>>
35: *
36: * @generated
37: */
38: final class DbSyncDefinitionBuilder extends AbstractBuilder
39: {
40: /**
41: * @internal
42: */
43: protected static function getService(): string
44: {
45: return DbSyncDefinition::class;
46: }
47:
48: /**
49: * The entity being serviced
50: *
51: * @template T of SyncEntityInterface
52: *
53: * @param class-string<T> $value
54: * @return static<T,TProvider>
55: */
56: public function entity(string $value)
57: {
58: /** @var static<T,TProvider> */
59: return $this->withValueB(__FUNCTION__, $value);
60: }
61:
62: /**
63: * The provider servicing the entity
64: *
65: * @template T of DbSyncProvider
66: *
67: * @param T $value
68: * @return static<TEntity,T>
69: */
70: public function provider(DbSyncProvider $value)
71: {
72: /** @var static<TEntity,T> */
73: return $this->withValueB(__FUNCTION__, $value);
74: }
75:
76: /**
77: * Pipeline that maps provider data to a serialized entity, or `null` if mapping is not required
78: *
79: * @template T of SyncEntityInterface
80: *
81: * @param PipelineInterface<mixed[],T,SyncPipelineArgument>|null $value
82: * @return static<T,TProvider>
83: */
84: public function pipelineFromBackend(?PipelineInterface $value)
85: {
86: /** @var static<T,TProvider> */
87: return $this->withValueB(__FUNCTION__, $value);
88: }
89:
90: /**
91: * Pipeline that maps a serialized entity to provider data, or `null` if mapping is not required
92: *
93: * @template T of SyncEntityInterface
94: *
95: * @param PipelineInterface<T,mixed[],SyncPipelineArgument>|null $value
96: * @return static<T,TProvider>
97: */
98: public function pipelineToBackend(?PipelineInterface $value)
99: {
100: /** @var static<T,TProvider> */
101: return $this->withValueB(__FUNCTION__, $value);
102: }
103: }
104: