1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Sync;
4:
5: use Salient\Contract\Sync\Exception\FilterPolicyViolationExceptionInterface;
6:
7: /**
8: * Policies for unclaimed sync operation filters
9: */
10: interface FilterPolicy
11: {
12: /**
13: * Ignore unclaimed filters
14: *
15: * The provider returns unfiltered entities, all of which are returned to
16: * the caller.
17: */
18: public const IGNORE = 0;
19:
20: /**
21: * Throw an exception if there are unclaimed filters
22: *
23: * A {@see FilterPolicyViolationExceptionInterface} is thrown and the
24: * request is not passed to the provider.
25: *
26: * This is the default policy.
27: */
28: public const THROW_EXCEPTION = 1;
29:
30: /**
31: * Return an empty result if there are unclaimed filters
32: *
33: * The request is not passed to the provider. An empty array (`[]`) is
34: * returned to the caller for {@see SyncOperation::CREATE_LIST},
35: * {@see SyncOperation::READ_LIST}, {@see SyncOperation::UPDATE_LIST} and
36: * {@see SyncOperation::DELETE_LIST}, otherwise `null` is returned.
37: */
38: public const RETURN_EMPTY = 2;
39:
40: /**
41: * Perform local filtering of entities returned by the provider
42: *
43: * The provider returns unfiltered entities, and any that don't match the
44: * unclaimed filters are removed from the result returned to the caller.
45: */
46: public const FILTER = 3;
47: }
48: