Add phone_id and update device_push_id field for mobile session #148

This commit is contained in:
Kendrick Chan 2018-06-17 17:03:34 +08:00
parent 997dd91e68
commit 2fa2ad964e
2 changed files with 26 additions and 9 deletions

View file

@ -131,7 +131,7 @@ class APIController extends Controller
'phone_model', 'phone_model',
'os_type', 'os_type',
'os_version', 'os_version',
'device_push_id' 'phone_id'
]; ];
$missing = $this->checkMissingParameters($req, $required_params); $missing = $this->checkMissingParameters($req, $required_params);
@ -155,7 +155,7 @@ class APIController extends Controller
$sess->setPhoneModel($req->request->get('phone_model')) $sess->setPhoneModel($req->request->get('phone_model'))
->setOSType($req->request->get('os_type')) ->setOSType($req->request->get('os_type'))
->setOSVersion($req->request->get('os_version')) ->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 // reopen in case we get an exception
if (!$em->isOpen()) if (!$em->isOpen())

View file

@ -20,28 +20,34 @@ class MobileSession
// phone model // phone model
/** /**
*@ORM\Column(type="string", length=50) * @ORM\Column(type="string", length=50)
*/ */
protected $phone_model; protected $phone_model;
// operating system (android, ios, etc) // operating system (android, ios, etc)
/** /**
*@ORM\Column(type="string", length=15) * @ORM\Column(type="string", length=15)
*/ */
protected $os_type; protected $os_type;
// os version // os version
/** /**
*@ORM\Column(type="string", length=25) * @ORM\Column(type="string", length=25)
*/ */
protected $os_version; protected $os_version;
// device id or push id used by device // device id or push id used by device
/** /**
*@ORM\Column(type="string", length=50) * @ORM\Column(type="string", length=200)
*/ */
protected $device_push_id; protected $device_push_id;
// phone id
/**
* @ORM\Column(type="string", length=50)
*/
protected $phone_id;
// link to customer // link to customer
/** /**
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="sessions") * @ORM\ManyToOne(targetEntity="Customer", inversedBy="sessions")
@ -51,19 +57,19 @@ class MobileSession
// phone number // phone number
/** /**
*@ORM\Column(type="string", length=12, nullable=true) * @ORM\Column(type="string", length=12, nullable=true)
*/ */
protected $phone_number; protected $phone_number;
// confirm code that we send via SMS // 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; protected $confirm_code;
// is confirmed? // is confirmed?
/** /**
*@ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected $confirm_flag; protected $confirm_flag;
@ -141,6 +147,17 @@ class MobileSession
return $this->os_version; 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) public function setDevicePushID($id)
{ {
$this->device_push_id = $id; $this->device_push_id = $id;