1 | <?php |
||
14 | abstract class DataProvider implements DataProviderInterface |
||
15 | { |
||
16 | const BATCH_SIZE = 1000; |
||
17 | |||
18 | /** |
||
19 | * @var Client |
||
20 | */ |
||
21 | private $client; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $index; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $type; |
||
32 | |||
33 | /** |
||
34 | * @var EventDispatcherInterface |
||
35 | */ |
||
36 | private $dispatcher; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $currentBulk; |
||
42 | |||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $currentBulkSize; |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 3 | public function run( |
|
69 | |||
70 | /** |
||
71 | * Populate |
||
72 | * |
||
73 | * @return null |
||
74 | */ |
||
75 | abstract protected function populate(); |
||
76 | |||
77 | /** |
||
78 | * Index document |
||
79 | * |
||
80 | * @param string $id |
||
81 | * @param array $body |
||
82 | */ |
||
83 | 2 | public function index($id, array $body) |
|
106 | |||
107 | 3 | protected function flushBulk() |
|
114 | |||
115 | 2 | private function shouldFlushBulk() |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | 1 | public function count() |
|
127 | } |
||
128 |