32 private $queryGenerator;
37 private $dataConverter;
42 private $selectFactory;
47 private $envBatchSize;
63 $this->queryGenerator = $queryGenerator;
64 $this->dataConverter = $dataConverter;
65 $this->selectFactory = $selectFactory;
66 $this->envBatchSize = $envBatchSize;
88 ->from(
$table, [$identifier, $field])
89 ->where($field .
' IS NOT NULL');
91 $queryModifier->modify(
$select);
93 $iterator = $this->queryGenerator->generate($identifier,
$select, $this->getBatchSize());
96 $uniqueFieldDataArray = array_unique($rows);
97 foreach ($uniqueFieldDataArray as $uniqueFieldData) {
98 $ids = array_keys($rows, $uniqueFieldData);
100 $convertedValue = $this->dataConverter->convert($uniqueFieldData);
101 if ($uniqueFieldData === $convertedValue) {
105 $bind = [$field => $convertedValue];
106 $where = [$identifier .
' IN (?)' => $ids];
109 throw new \Magento\Framework\DB\FieldDataConversionException(
116 get_class($this->dataConverter),
130 private function getBatchSize()
132 if (
null !== $this->envBatchSize) {
133 $batchSize = (int) $this->envBatchSize;
134 if (bccomp($this->envBatchSize, PHP_INT_MAX, 0) === 1 || $batchSize < 1) {
135 throw new \InvalidArgumentException(
136 'Invalid value for environment variable ' . self::BATCH_SIZE_VARIABLE_NAME .
'. ' 137 .
'Should be integer, >= 1 and < value of PHP_INT_MAX'
const BATCH_SIZE_VARIABLE_NAME
__construct(Generator $queryGenerator, DataConverterInterface $dataConverter, SelectFactory $selectFactory, $envBatchSize=null)
convert(AdapterInterface $connection, $table, $identifier, $field, QueryModifierInterface $queryModifier=null)