From 9a4ead6ab9c74c51934def9e1e93836de1fa939d Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Thu, 21 Nov 2019 09:18:31 +0800 Subject: [PATCH] Return the customer and customer vehicle saving #274 --- src/Command/CreateCustomerFromWarrantyCommand.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Command/CreateCustomerFromWarrantyCommand.php b/src/Command/CreateCustomerFromWarrantyCommand.php index 9303c0c4..841be142 100644 --- a/src/Command/CreateCustomerFromWarrantyCommand.php +++ b/src/Command/CreateCustomerFromWarrantyCommand.php @@ -175,6 +175,7 @@ class CreateCustomerFromWarrantyCommand extends Command // if there was a customer vehicle matched if ($cv_found) { + // vehicle found, do nothing. error_log('vehicle found - ' . $w_plate_number); } else @@ -182,10 +183,8 @@ class CreateCustomerFromWarrantyCommand extends Command // customer exists but not customer vehicle // add customer vehicle to existing customer with unknown manufacturer and make error_log('new vehicle - ' . $w_plate_number); - /* $this->createCustomerVehicle($customer, $default_vehicle, $w_plate_number); $total_cv_added++; - */ } } } @@ -193,7 +192,6 @@ class CreateCustomerFromWarrantyCommand extends Command else { error_log('NEW customer and vehicle - ' . $w_plate_number); - /* // customer not found, add customer and customer vehicle // get warranty first name, last name $w_first_name = $warr->getFirstName(); @@ -209,7 +207,6 @@ class CreateCustomerFromWarrantyCommand extends Command ->setPhoneMobile($w_mobile_num); $this->em->persist($new_cust); - $this->em->flush(); $this->createCustomerVehicle($new_cust, $default_vehicle, $w_plate_number); @@ -218,9 +215,9 @@ class CreateCustomerFromWarrantyCommand extends Command $total_cust_added++; $total_cv_added++; - */ } } + $this->em->flush(); $this->em->clear(); } @@ -326,7 +323,6 @@ class CreateCustomerFromWarrantyCommand extends Command ->setVehicle($vehicle); $this->em->persist($new_cv); - $this->em->flush(); } protected function processInvalidEntries($warr)