コード例 #1
0
 private function generateBatches($csvImages, $itemForBatch)
 {
     $source = HelperFileFormatting::csvToArray($csvImages);
     $batches = array_chunk($source, $itemForBatch);
     $columDefinition = array('idProduct', 'pathImg');
     $batches = HelperFileFormatting::unshiftColumDefinition($batches, $columDefinition);
     foreach ($batches as $key => $batch) {
         $batchName = BATCHES_PATH . 'batch' . $key . '.csv';
         $zipName = BATCHES_PATH . 'batch' . $key . '.zip';
         HelperFileFormatting::createCsv($batch, $batchName, ',');
         HelperFileFormatting::createZip($zipName, $this->getImagesFromBatch($batch), IMAGES_PATH);
     }
 }