1 | <?php |
||
10 | class Populator |
||
11 | { |
||
12 | /** |
||
13 | * @var Type |
||
14 | */ |
||
15 | private $type; |
||
16 | |||
17 | /** |
||
18 | * @var PopulationFetcherInterface |
||
19 | */ |
||
20 | private $fetcher; |
||
21 | |||
22 | /** |
||
23 | * @var TransformerManager |
||
24 | */ |
||
25 | private $transformer; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | private $entityCount; |
||
31 | |||
32 | /** |
||
33 | * @param Type $type |
||
34 | * @param PopulationFetcherInterface $fetcher |
||
35 | * @param TransformerManager $transformer |
||
36 | */ |
||
37 | public function __construct(Type $type, PopulationFetcherInterface $fetcher, TransformerManager $transformer) |
||
45 | |||
46 | /** |
||
47 | * @param array $entities |
||
48 | * @return Document[] |
||
49 | */ |
||
50 | protected function transformEntitiesToDocuments(array $entities) |
||
64 | |||
65 | /** |
||
66 | * TODO: make a progress bar interface an an adapter for symfony's ProgressBar |
||
67 | * |
||
68 | * @param int $batchSize |
||
69 | * @param ProgressBar $progress |
||
70 | * @return int Number of documents created/updated. |
||
71 | */ |
||
72 | public function populate($batchSize, ProgressBar $progress = null) |
||
108 | } |
||
109 |