From 2125f36e77033db9ad56ad4a15adf8279af9e67a Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 23 Jun 2021 08:24:49 +0000 Subject: [PATCH] Add MobileUser entity. Add association between MobileUser and Customer. #591 --- src/Entity/Customer.php | 25 ++++ src/Entity/MobileUser.php | 268 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 293 insertions(+) create mode 100644 src/Entity/MobileUser.php diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index 2257bfb2..54f9e8ba 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -215,6 +215,12 @@ class Customer */ protected $customer_tags; + // mobile users linked to this customer + /** + * @ORM\OneToMany(targetEntity="MobileUser", mappedBy="customer") + */ + protected $mobile_users; + public function __construct() { $this->numbers = new ArrayCollection(); @@ -222,6 +228,7 @@ class Customer $this->vehicles = new ArrayCollection(); $this->job_orders = new ArrayCollection(); $this->customer_tags = new ArrayCollection(); + $this->mobile_users = new ArrayCollection(); $this->customer_classification = CustomerClassification::REGULAR; $this->customer_notes = ''; @@ -656,4 +663,22 @@ class Customer $this->customer_tags->removeElement($customer_tag); $customer_tag->removeCustomer($this); } + + public function addMobileUser(MobileUser $mobile_user) + { + $this->mobile_users->add($mobile_user); + return $this; + } + + public function clearMobileUsers() + { + $this->mobile_users->clear(); + return $this; + } + + public function getMobileUsers() + { + return $this->mobile_users; + } + } diff --git a/src/Entity/MobileUser.php b/src/Entity/MobileUser.php new file mode 100644 index 00000000..0830ae89 --- /dev/null +++ b/src/Entity/MobileUser.php @@ -0,0 +1,268 @@ +id = $this->generateKeyID(); + $this->date_generated = new DateTime(); + $this->customer = null; + $this->confirm_flag = false; + $this->date_confirmed = null; + $this->date_code_sent = null; + $this->reviews = new ArrayCollection(); + $this->capi_user_id = 0; + } + + public function generateKeyID() + { + // use uniqid for now, since primary key dupes will trigger exceptions + return uniqid(); + } + + public function getID() + { + return $this->id; + } + + public function setPhoneModel($model) + { + $this->phone_model = $model; + return $this; + } + + public function getPhoneModel() + { + return $this->phone_model; + } + + public function setOSType($type) + { + $this->os_type = $type; + return $this; + } + + public function getOSType() + { + return $this->os_type; + } + + public function getOSVersion() + { + return $this->os_version; + } + + public function setPhoneID($id) + { + $this->phone_id = $id; + return $this; + } + + public function getPhoneID() + { + return $this->phone_id; + } + + public function setDevicePushID($id) + { + $this->device_push_id = $id; + return $this; + } + + public function getDevicePushID() + { + return $this->device_push_id; + } + + public function setCustomer(Customer $cust = null) + { + $this->customer = $cust; + return $this; + } + + public function getCustomer() + { + return $this->customer; + } + + public function getDateGenerated() + { + return $this->date_generated; + } + + public function setPhoneNumber($num) + { + $this->phone_number = $num; + return $this; + } + + public function getPhoneNumber() + { + return $this->phone_number; + } + + public function setConfirmCode($code) + { + $this->confirm_code = $code; + return $this; + } + + public function getConfirmCode() + { + return $this->confirm_code; + } + + public function setConfirmed($flag = true) + { + $this->confirm_flag = $flag; + return $this; + } + + public function isConfirmed() + { + return $this->confirm_flag; + } + + public function setDateConfirmed(DateTime $date) + { + $this->date_confirmed = $date; + return $this; + } + + public function getDateConfirmed() + { + return $this->date_confirmed; + } + + public function setDateCodeSent(DateTime $date) + { + $this->date_code_sent = $date; + return $this; + } + + public function getDateCodeSent() + { + return $this->date_code_sent; + } + + public function getReviews() + { + return $this->reviews; + } + + public function setCapiUserId($capi_user_id) + { + $this->capi_user_id = $capi_user_id; + } + + public function getCapiUserId() + { + return $this->capi_user_id; + } + +}