diff --git a/src/Command/ImportSAPBatteryCommand.php b/src/Command/ImportSAPBatteryCommand.php index fcd54f7d..8ea53a1d 100644 --- a/src/Command/ImportSAPBatteryCommand.php +++ b/src/Command/ImportSAPBatteryCommand.php @@ -77,7 +77,7 @@ class ImportSAPBatteryCommand extends Command // clean up fields $clean_brand = trim($fields[0]); - $clean_sku = trim($fields[1]); + $clean_sku = strtoupper(trim($fields[1])); $clean_size = trim($fields[2]); $output->writeln("Parsing $clean_sku..."); @@ -110,11 +110,17 @@ class ImportSAPBatteryCommand extends Command // create battery entry $battery = new SAPBattery(); $battery->setID($clean_sku) - ->setSize($size_hash[$clean_size]) - ->setBrand($brand_hash[$clean_brand]); + ->setSize($this->batt_size_hash[$clean_size]) + ->setBrand($this->batt_brand_hash[$clean_brand]); $em->persist($battery); } + else + { + // TODO: different batteries but same SKU: WCHD23BL-CPN00-LX + // how to process? + error_log('Battery with that sku already exists.'); + } } $em->flush();