From fd6860442f00abba8c526292c50243a02feb9dc5 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Wed, 31 Mar 2021 17:15:27 +0800 Subject: [PATCH] Add province id and municipality id #540 --- .../CAPI/CustomerWarrantyController.php | 12 ++++++- src/Entity/Warranty.php | 32 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Controller/CAPI/CustomerWarrantyController.php b/src/Controller/CAPI/CustomerWarrantyController.php index 59c30f62..0ebc2c60 100644 --- a/src/Controller/CAPI/CustomerWarrantyController.php +++ b/src/Controller/CAPI/CustomerWarrantyController.php @@ -199,6 +199,8 @@ class CustomerWarrantyController extends APIController 'vmodel' => $warr->getVehicleModelYear(), 'dealer_name' => $warr->getDealerName(), 'dealer_address' => $warr->getDealerAddress(), + 'province_id' => $warr->getProvinceID(), + 'municipality_id' => $warr->getMunicipalityID(), ]; } else @@ -224,6 +226,8 @@ class CustomerWarrantyController extends APIController 'vmodel' => '', 'dealer_name' => '', 'dealer_address' => '', + 'province_id' => '', + 'municipality_id' => '', ]; } @@ -263,6 +267,8 @@ class CustomerWarrantyController extends APIController 'vmodel' => $other_data['vmodel'], 'dealer_name' => $other_data['dealer_name'], 'dealer_address' => $other_data['dealer_address'], + 'province_id' => $other_data['province_id'], + 'municipality_id' => $other_data['municipality_id'], ]; return new APIResponse(true, 'Warranty found.', $data); @@ -467,7 +473,11 @@ class CustomerWarrantyController extends APIController ->setDealerName($req->request->get('dealer_name')) ->setDealerAddress($req->request->get('dealer_address')) ->setCustomer($cust) - ->setValidated(false); + ->setValidated(false) + + // and more new fields + ->setProvinceID($req->request->get('province_id')) + ->setMunicipalityID($req->request->get('municipality_id')); // TODO: check for date purchase and date expire diff --git a/src/Entity/Warranty.php b/src/Entity/Warranty.php index 16a08a5b..9af986d3 100644 --- a/src/Entity/Warranty.php +++ b/src/Entity/Warranty.php @@ -222,6 +222,16 @@ class Warranty */ protected $customer; + /** + * @ORM\Column(type="string", length=11, nullable=true) + */ + protected $province_id; + + /** + * @ORM\Column(type="string", length=11, nullable=true) + */ + protected $municipality_id; + public function __construct() { $this->date_create = new DateTime(); @@ -626,4 +636,26 @@ class Warranty { return $this->customer; } + + public function setProvinceID($province_id) + { + $this->province_id = $province_id; + return $this; + } + + public function getProvinceID() + { + return $this->province_id; + } + + public function setMunicipalityID($municipality_id) + { + $this->municipality_id = $municipality_id; + return $this; + } + + public function getMunicipalityID() + { + return $this->municipality_id; + } }