From 9d74fd9a1d58a7cd58943fe75dcb0403cbbd0788 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Wed, 31 Jan 2018 03:03:28 +0800 Subject: [PATCH] Add ticket entity and associations --- src/Entity/Customer.php | 16 ++++ src/Entity/Ticket.php | 205 ++++++++++++++++++++++++++++++++++++++++ src/Entity/User.php | 12 +++ 3 files changed, 233 insertions(+) create mode 100644 src/Entity/Ticket.php diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index e35e3767..f9939d1f 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -63,6 +63,12 @@ class Customer */ protected $job_orders; + // tickets made by customer + /** + * @ORM\OneToMany(targetEntity="Ticket", mappedBy="customer") + */ + protected $tickets; + // if any of their mobile numbers have been confirmed /** * @ORM\Column(type="boolean") @@ -185,4 +191,14 @@ class Customer { return $this->flag_confirmed; } + + public function getJobOrders() + { + return $this->job_orders; + } + + public function getTickets() + { + return $this->tickets; + } } diff --git a/src/Entity/Ticket.php b/src/Entity/Ticket.php new file mode 100644 index 00000000..bdd070d0 --- /dev/null +++ b/src/Entity/Ticket.php @@ -0,0 +1,205 @@ +date_create = new DateTime(); + } + + public function getID() + { + return $this->id; + } + + public function setDateCreate($date_create) + { + $this->date_create = $date_create; + return $this; + } + + public function getDateCreate() + { + return $this->date_create; + } + + public function setStatus($status) + { + $this->status = $status; + return $this; + } + + public function getStatus() + { + return $this->status; + } + + public function setType($type) + { + $this->type = $type; + return $this; + } + + public function getType() + { + return $this->type; + } + + public function setOtherType($other_type) + { + $this->other_type = $other_type; + return $this; + } + + public function getOtherType() + { + return $this->other_type; + } + + 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 setContactNumber($num) + { + $this->contact_num = $num; + return $this; + } + + public function getContactNumber() + { + return $this->contact_num; + } + + public function setDetails($details) + { + $this->details = $details; + return $this; + } + + public function getDetails() + { + return $this->details; + } + + public function setCreatedBy(User $created_by) + { + $this->created_by = $created_by; + return $this; + } + + public function getCreatedBy() + { + return $this->created_by; + } + + public function setCustomer(Customer $customer) + { + $this->customer = $customer; + return $this; + } + + public function getCustomer() + { + return $this->customer; + } +} diff --git a/src/Entity/User.php b/src/Entity/User.php index 1cfeabf6..c81a20f0 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -79,11 +79,18 @@ class User implements AdvancedUserInterface, Serializable */ protected $job_orders_assigned; + // tickets made by this user + /** + * @ORM\OneToMany(targetEntity="Ticket", mappedBy="created_by") + */ + protected $tickets; + public function __construct() { $this->roles = new ArrayCollection(); $this->job_orders_created = new ArrayCollection(); $this->job_orders_assigned = new ArrayCollection(); + $this->tickets = new ArrayCollection(); $this->enabled = true; } @@ -267,4 +274,9 @@ class User implements AdvancedUserInterface, Serializable { return $this->job_orders_assigned; } + + public function getTickets() + { + return $this->tickets; + } }