Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BatchSizeCalculator.php
Go to the documentation of this file.
1 <?php
8 
11 
18 {
22  private $batchSizes;
23 
27  private $batchSizeManagers;
28 
33  public function __construct(
34  array $batchSizes,
35  array $batchSizeManagers
36  ) {
37  $this->batchSizes = $batchSizes;
38  $this->batchSizeManagers = $batchSizeManagers;
39  }
40 
49  public function estimateBatchSize(
51  $indexerTypeId
52  ) {
53  if (!isset($this->batchSizes[$indexerTypeId])) {
54  throw NoSuchEntityException::singleField('indexTypeId', $indexerTypeId);
55  }
56  $this->batchSizeManagers[$indexerTypeId]->ensureBatchSize($connection, $this->batchSizes[$indexerTypeId]);
57 
58  return $this->batchSizes[$indexerTypeId];
59  }
60 }
$connection
Definition: bulk.php:13