1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Contract\Sync; |
4: | |
5: | use Salient\Contract\Core\Entity\SerializeRulesInterface; |
6: | use Closure; |
7: | |
8: | /** |
9: | * @api |
10: | * |
11: | * @template TEntity of SyncEntityInterface |
12: | * |
13: | * @extends SerializeRulesInterface<TEntity> |
14: | */ |
15: | interface SyncSerializeRulesInterface extends SerializeRulesInterface |
16: | { |
17: | /** |
18: | * @inheritDoc |
19: | * |
20: | * @return array<string,array{string|null,(Closure(mixed $value, SyncStoreInterface|null $store=): mixed)|null}> |
21: | */ |
22: | public function getReplaceableKeys(?string $class, ?string $baseClass, array $path): array; |
23: | |
24: | /** |
25: | * Check if entities should be serialized for an entity store |
26: | */ |
27: | public function getForSyncStore(): bool; |
28: | |
29: | /** |
30: | * Get an instance where entities are serialized for an entity store |
31: | * |
32: | * @return static |
33: | */ |
34: | public function withForSyncStore(?bool $forSyncStore = true): self; |
35: | |
36: | /** |
37: | * Check if the canonical identifiers of sync entities should be included |
38: | * when they are serialized |
39: | */ |
40: | public function getCanonicalId(): bool; |
41: | |
42: | /** |
43: | * Get an instance where the canonical identifiers of sync entities are |
44: | * included when they are serialized |
45: | * |
46: | * @return static |
47: | */ |
48: | public function withCanonicalId(?bool $include = true): self; |
49: | } |
50: |