From 59f29b223dfc6bb1812121d9edf334850eaebd42 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 5 May 2021 06:03:48 +0000 Subject: [PATCH] Add entities for the customer tag and promo log. #558 --- src/Entity/Customer.php | 30 +++++++ src/Entity/CustomerTag.php | 93 ++++++++++++++++++++ src/Entity/PromoLog.php | 168 +++++++++++++++++++++++++++++++++++++ 3 files changed, 291 insertions(+) create mode 100644 src/Entity/CustomerTag.php create mode 100644 src/Entity/PromoLog.php diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index f5e8e4e9..8ee3837a 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -208,12 +208,20 @@ class Customer */ protected $create_source; + // customer tags + /** + * @ORM\ManyToMany(targetEntity="CustomerTag", inversedBy="customers") + * @ORM\JoinTable(name="customer_customer_tags") + */ + protected $customer_tags; + public function __construct() { $this->numbers = new ArrayCollection(); $this->sessions = new ArrayCollection(); $this->vehicles = new ArrayCollection(); $this->job_orders = new ArrayCollection(); + $this->customer_tags = new ArrayCollection(); $this->customer_classification = CustomerClassification::REGULAR; $this->customer_notes = ''; @@ -608,4 +616,26 @@ class Customer { return $this->create_source; } + + public function addCustomerTag(CustomerTag $customer_tag) + { + $this->customer_tags->add($customer_tag); + return $this; + } + + public function clearCustomerTags() + { + $this->customer_tags->clear(); + return $this; + } + + public function getCustomerTags() + { + $str_customer_tags = []; + foreach ($this->customer_tags as $customer_tag) + $str_customer_tags[] = $customer_tag->getID(); + + return $str_customer_tags; + } + } diff --git a/src/Entity/CustomerTag.php b/src/Entity/CustomerTag.php new file mode 100644 index 00000000..a3c87423 --- /dev/null +++ b/src/Entity/CustomerTag.php @@ -0,0 +1,93 @@ +date_create = new DateTime(); + $this->customers = new ArrayCollection(); + $this->car_club_member = false; + $this->car_club_promo = false; + } + + public function getID() + { + return $this->id; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } + + public function getDateCreate() + { + return $this->date_create; + } + + public function addCustomer(Customer $customer) + { + $this->customers[$customer->getID()] = $customer; + + return $this; + } + + public function clearCustomers() + { + $this->customers->clear(); + return $this; + } + + public function getCustomers() + { + return $this->customers; + } +} diff --git a/src/Entity/PromoLog.php b/src/Entity/PromoLog.php new file mode 100644 index 00000000..0decf2a7 --- /dev/null +++ b/src/Entity/PromoLog.php @@ -0,0 +1,168 @@ +date_create = new DateTime(); + } + + public function getID() + { + return $this->id; + } + + public function setDateCreate(DateTime $date_create) + { + $this->date_create = $date_create; + return $this; + } + + public function getDateCreate() + { + return $this->date_create; + } + + public function setCreatedBy($created_by) + { + $this->created_by = $created_by; + return $this; + } + + public function getCreatedBy() + { + return $this->created_by; + } + + public function setCustId($cust_id) + { + $this->cust_id = $cust_id; + return $this; + } + + public function getCustId() + { + return $this->cust_id; + } + + public function setCustFirstName($cust_first_name) + { + $this->cust_first_name = $cust_first_name; + return $this; + } + + public function getCustFirstName() + { + return $this->cust_first_name; + } + + public function setCustLastName($cust_last_name) + { + $this->cust_last_name = $cust_last_name; + return $this; + } + + public function getCustLastName() + { + return $this->cust_last_name; + } + + public function setJoId($jo_id) + { + $this->jo_id = $jo_id; + return $this; + } + + public function getJoId() + { + return $this->jo_id; + } + + public function setInvoiceId($invoice_id) + { + $this->invoice_id = $invoice_id; + return $this; + } + + public function getInvoiceId() + { + return $this->invoice_id; + } + + public function setAmount($amount) + { + $this->amount = $amount; + return $this; + } + + public function getAmount() + { + return $this->amount; + } +}