From e14947e4869ed7033a0d234ded3c4d1301947ea4 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 16 Mar 2020 07:33:28 +0000 Subject: [PATCH] Add customer, customer vehicle, distributor and retailer entities. #370 --- src/Service/Prowar/Entity/Customer.php | 222 ++++++++++++++++++ src/Service/Prowar/Entity/CustomerVehicle.php | 77 ++++++ src/Service/Prowar/Entity/Distributor.php | 82 +++++++ src/Service/Prowar/Entity/Retailer.php | 61 +++++ 4 files changed, 442 insertions(+) create mode 100644 src/Service/Prowar/Entity/Customer.php create mode 100644 src/Service/Prowar/Entity/CustomerVehicle.php create mode 100644 src/Service/Prowar/Entity/Distributor.php create mode 100644 src/Service/Prowar/Entity/Retailer.php diff --git a/src/Service/Prowar/Entity/Customer.php b/src/Service/Prowar/Entity/Customer.php new file mode 100644 index 00000000..a9d4dcdd --- /dev/null +++ b/src/Service/Prowar/Entity/Customer.php @@ -0,0 +1,222 @@ +vehicles = new ArrayCollection(); + } + + public function getID() + { + return $this->id; + } + + + public function setFirstName($first_name) + { + $this->first_name = $first_name; + return $this; + } + + public function getFirstName() + { + return $this->first_name; + } + + public function setLastName($last_name) + { + $this->last_name = $last_name; + return $this; + } + + public function getLastName() + { + return $this->last_name; + } + + public function getNameDisplay() + { + return $this->first_name . ' ' . $this->last_name; + } + + public function setCustomerNotes($customer_notes) + { + $this->customer_notes = $customer_notes; + return $this; + } + + public function getCustomerNotes() + { + return $this->customer_notes; + } + + public function getMobileNumberList() + { + $phones = []; + + if (!empty($this->phone_mobile)) + $phones[] = $this->phone_mobile; + + if (!empty($this->phone_landline)) + $phones[] = $this->phone_landline; + + if (!empty($this->phone_office)) + $phones[] = $this->phone_office; + + if (!empty($this->phone_fax)) + $phones[] = $this->phone_fax; + + return $phones; + } + + public function setPhoneMobile($phone) + { + $this->phone_mobile = $phone; + return $this; + } + + public function getPhoneMobile() + { + return $this->phone_mobile; + } + + public function setPhoneLandline($phone) + { + $this->phone_landline = $phone; + return $this; + } + + public function getPhoneLandline() + { + return $this->phone_landline; + } + + public function setPhoneOffice($phone) + { + $this->phone_office = $phone; + return $this; + } + + public function getPhoneOffice() + { + return $this->phone_office; + } + + public function setPhoneFax($phone) + { + $this->phone_fax = $phone; + return $this; + } + + public function getPhoneFax() + { + return $this->phone_fax; + } + + public function setEmail($email) + { + $this->email = $email; + return $this; + } + + public function getEmail() + { + return $this->email; + } + + public function addVehicle(CustomerVehicle $vehicle) + { + $this->vehicles->add($vehicle); + return $this; + } + + public function clearVehicles() + { + $this->vehicles->clear(); + return $this; + } + + public function removeVehicle($vehicle) + { + $this->vehicles->removeElement($vehicle); + return $this; + } + + public function getVehicles() + { + return $this->vehicles; + } +} diff --git a/src/Service/Prowar/Entity/CustomerVehicle.php b/src/Service/Prowar/Entity/CustomerVehicle.php new file mode 100644 index 00000000..07c88ac9 --- /dev/null +++ b/src/Service/Prowar/Entity/CustomerVehicle.php @@ -0,0 +1,77 @@ +id; + } + + public function setCustomer(Customer $customer) + { + $this->customer = $customer; + return $this; + } + + public function getCustomer() + { + return $this->customer; + } + + public function setPlateNumber($plate_number) + { + // make it upper case + $plate_number = trim(strtoupper($plate_number)); + + // remove spaces + $plate_number = str_replace(' ', '', $plate_number); + + // upper case + $plate_number = strtoupper($plate_number); + + $this->plate_number = $plate_number; + return $this; + } + + public function getPlateNumber() + { + return strtoupper($this->plate_number); + } +} diff --git a/src/Service/Prowar/Entity/Distributor.php b/src/Service/Prowar/Entity/Distributor.php new file mode 100644 index 00000000..7de6bbb7 --- /dev/null +++ b/src/Service/Prowar/Entity/Distributor.php @@ -0,0 +1,82 @@ +retailers = new ArrayCollection(); + } + + public function getID() + { + return $this->id; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } + + public function addRetailer(Retailer $retailer) + { + if (!isset($this->retailers[$retailer->getID()])) + $this->retailers[$retailer->getID()] = $retailer; + return $this; + } + + public function removeRetailer(Retailer $retailer) + { + if (isset($this->retailers[$retailer->getID()])) + unset($this->retailers[$retailer->getID()]); + return $this; + } + + public function clearRetailers() + { + $this->retailers->clear(); + return $this; + } + + public function getRetailers() + { + return $this->retailers; + } +} diff --git a/src/Service/Prowar/Entity/Retailer.php b/src/Service/Prowar/Entity/Retailer.php new file mode 100644 index 00000000..96dba0ba --- /dev/null +++ b/src/Service/Prowar/Entity/Retailer.php @@ -0,0 +1,61 @@ +distributors = new ArrayCollection(); + } + + public function getID() + { + return $this->id; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } + + public function getDistributors() + { + return $this->distributors; + } +}