From 2fa2ad964ef9f8596ce1f84bbc8a5f1053817ca5 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Sun, 17 Jun 2018 17:03:34 +0800 Subject: [PATCH] Add phone_id and update device_push_id field for mobile session #148 --- src/Controller/APIController.php | 4 ++-- src/Entity/MobileSession.php | 31 ++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index f7171fd5..db83794b 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -131,7 +131,7 @@ class APIController extends Controller 'phone_model', 'os_type', 'os_version', - 'device_push_id' + 'phone_id' ]; $missing = $this->checkMissingParameters($req, $required_params); @@ -155,7 +155,7 @@ class APIController extends Controller $sess->setPhoneModel($req->request->get('phone_model')) ->setOSType($req->request->get('os_type')) ->setOSVersion($req->request->get('os_version')) - ->setDevicePushID($req->request->get('device_push_id')); + ->setPhoneID($req->request->get('phone_id')); // reopen in case we get an exception if (!$em->isOpen()) diff --git a/src/Entity/MobileSession.php b/src/Entity/MobileSession.php index c11986f4..f81578e2 100644 --- a/src/Entity/MobileSession.php +++ b/src/Entity/MobileSession.php @@ -20,28 +20,34 @@ class MobileSession // phone model /** - *@ORM\Column(type="string", length=50) + * @ORM\Column(type="string", length=50) */ protected $phone_model; // operating system (android, ios, etc) /** - *@ORM\Column(type="string", length=15) + * @ORM\Column(type="string", length=15) */ protected $os_type; // os version /** - *@ORM\Column(type="string", length=25) + * @ORM\Column(type="string", length=25) */ protected $os_version; // device id or push id used by device /** - *@ORM\Column(type="string", length=50) + * @ORM\Column(type="string", length=200) */ protected $device_push_id; + // phone id + /** + * @ORM\Column(type="string", length=50) + */ + protected $phone_id; + // link to customer /** * @ORM\ManyToOne(targetEntity="Customer", inversedBy="sessions") @@ -51,19 +57,19 @@ class MobileSession // phone number /** - *@ORM\Column(type="string", length=12, nullable=true) + * @ORM\Column(type="string", length=12, nullable=true) */ protected $phone_number; // confirm code that we send via SMS /** - *@ORM\Column(type="string", length=6, nullable=true) + * @ORM\Column(type="string", length=6, nullable=true) */ protected $confirm_code; // is confirmed? /** - *@ORM\Column(type="boolean") + * @ORM\Column(type="boolean") */ protected $confirm_flag; @@ -141,6 +147,17 @@ class MobileSession 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;