From dfffcc43cb498be722eb1d20f03e8c7fe039282e Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 16 Feb 2018 16:58:46 +0800 Subject: [PATCH 1/2] Add rider rating entity #10 --- src/Entity/RiderRating.php | 114 +++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/Entity/RiderRating.php diff --git a/src/Entity/RiderRating.php b/src/Entity/RiderRating.php new file mode 100644 index 00000000..e0a03ddc --- /dev/null +++ b/src/Entity/RiderRating.php @@ -0,0 +1,114 @@ +date_create = new DateTime(); + $this->rating = 0; + } + + public function getID() + { + return $this->id; + } + + public function setRider(Rider $rider) + { + $this->rider = $rider; + return $this; + } + + public function getRider() + { + return $this->rider; + } + + public function setCustomer(Customer $customer) + { + $this->customer = $customer; + return $this; + } + + public function getCustomer() + { + return $this->customer; + } + + public function setJobOrder(JobOrder $job_order) + { + $this->job_order = $job_order; + return $this; + } + + public function getJobOrder() + { + return $this->job_order; + } + + public function getDateCreate() + { + return $this->date_create; + } + + public function setRating($rating) + { + $this->rating = $rating; + return $this; + } + + public function getRating() + { + return $this->rating; + } +} From 3df1470559ff603a49b07371b6d6064e3ddc144e Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 16 Feb 2018 16:58:57 +0800 Subject: [PATCH 2/2] Add current rating field for Rider entity #10 --- src/Entity/Rider.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Entity/Rider.php b/src/Entity/Rider.php index 1165371f..a99e8bae 100644 --- a/src/Entity/Rider.php +++ b/src/Entity/Rider.php @@ -46,25 +46,35 @@ class Rider */ protected $plate_number; + // hub that the rider is assigned to /** * @ORM\ManyToOne(targetEntity="Hub", inversedBy="riders") * @ORM\JoinColumn(name="hub_id", referencedColumnName="id") */ protected $hub; + // job orders that the rider has done /** * @ORM\OneToMany(targetEntity="JobOrder", mappedBy="rider") */ protected $job_orders; + // picture of rider /** * @ORM\Column(type="string", nullable=true) */ protected $image_file; + // current rating of rider + /** + * @ORM\Column(type="integer") + */ + protected $curr_rating; + public function __construct() { $this->job_orders = new ArrayCollection(); + $this->curr_rating = 0; } public function getID() @@ -148,4 +158,15 @@ class Rider { return $this->image_file; } + + public function setCurrentRating($rating) + { + $this->curr_rating = $rating; + return $this; + } + + public function getCurrentRating() + { + return $this->curr_rating; + } }