1 | <?php |
||
16 | abstract class AbstractSyncCommand extends Command implements CommandInterface |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var boolean |
||
21 | */ |
||
22 | protected $ignoreExisting; |
||
23 | |||
24 | /** |
||
25 | * @var ContentfulServiceContract |
||
26 | */ |
||
27 | protected $contentfulService; |
||
28 | |||
29 | /** |
||
30 | * @var ContentfulSyncServiceContract |
||
31 | */ |
||
32 | protected $contentfulSyncService; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $contentTypes; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | protected $numSynchronized; |
||
43 | |||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | protected $skip; |
||
48 | |||
49 | /** |
||
50 | * @var int |
||
51 | */ |
||
52 | protected $batchSize; |
||
53 | |||
54 | /** |
||
55 | * @param null|string $contentType the content type, or null if not applicable |
||
56 | * |
||
57 | * @return Query the query used to fetch all entries/assets |
||
58 | */ |
||
59 | abstract protected function getQuery(?string $contentType = null): Query; |
||
60 | |||
61 | /** |
||
62 | * @param null|string $contentType the content type, or null if not applicable |
||
63 | * |
||
64 | * @return Query the query used to get the total number of items |
||
65 | */ |
||
66 | protected function getTotalQuery(?string $contentType = null): Query |
||
73 | |||
74 | /** |
||
75 | * AbstractSyncCommand constructor. |
||
76 | * |
||
77 | * @param array $contentTypes |
||
78 | * @param ContentfulServiceContract $contentfulService |
||
79 | * @param ContentfulSyncServiceContract $contentfulSyncService |
||
80 | */ |
||
81 | public function __construct( |
||
92 | |||
93 | /** |
||
94 | * @inheritdoc |
||
95 | * |
||
96 | * @throws \Throwable |
||
97 | */ |
||
98 | public function handle() |
||
106 | |||
107 | /** |
||
108 | * @return ClientInterface |
||
109 | */ |
||
110 | protected function getClient(): ClientInterface |
||
114 | |||
115 | /** |
||
116 | * Resets the "skip" and "numSynchronized" counters |
||
117 | */ |
||
118 | protected function resetCounters(): void |
||
123 | } |
||
124 |