From 7e53a4d6de86bbdaecbac0456130a57442783dca Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Mon, 21 May 2018 01:23:59 +0800 Subject: [PATCH] Add rider rating comment feature #120 --- src/Controller/APIController.php | 5 +++++ src/Entity/RiderRating.php | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index e0de5ad2..acf3cb74 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -1225,6 +1225,11 @@ class APIController extends Controller ->setJobOrder($jo) ->setRating($rating_num); + // rider rating comment + $comment = $req->request->get('comment'); + if (!empty($comment)) + $rating->setComment($comment); + $em->persist($rating); $em->flush(); diff --git a/src/Entity/RiderRating.php b/src/Entity/RiderRating.php index e0a03ddc..f5875c27 100644 --- a/src/Entity/RiderRating.php +++ b/src/Entity/RiderRating.php @@ -52,10 +52,17 @@ class RiderRating */ protected $rating; + // customer's comment that goes along with the rating + /** + * @ORM\Column(type="text") + */ + protected $comment; + public function __construct() { $this->date_create = new DateTime(); $this->rating = 0; + $this->comment = ''; } public function getID() @@ -111,4 +118,15 @@ class RiderRating { return $this->rating; } + + public function setComment($comment) + { + $this->comment = $comment; + return $this; + } + + public function getComment() + { + return $this->comment; + } } -- 2.43.5