Add error_logging in case of duplicate SAP battery. #371
This commit is contained in:
parent
506505bff5
commit
1829e9112e
1 changed files with 9 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue