Adjust mobile session entity
This commit is contained in:
parent
bcfa77151c
commit
db0a53fd1e
1 changed files with 168 additions and 3 deletions
|
|
@ -14,29 +14,194 @@ class MobileSession
|
||||||
// unique id
|
// unique id
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(type="string", length=10)
|
* @ORM\Column(type="string", length=13)
|
||||||
*/
|
*/
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
|
// phone model
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=50)
|
||||||
|
*/
|
||||||
|
protected $phone_model;
|
||||||
|
|
||||||
|
// operating system (android, ios, etc)
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=15)
|
||||||
|
*/
|
||||||
|
protected $os_type;
|
||||||
|
|
||||||
|
// os version
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=25)
|
||||||
|
*/
|
||||||
|
protected $os_version;
|
||||||
|
|
||||||
|
// device id or push id used by device
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=50)
|
||||||
|
*/
|
||||||
|
protected $device_push_id;
|
||||||
|
|
||||||
// link to customer
|
// link to customer
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="sessions")
|
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="sessions")
|
||||||
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $customer;
|
protected $customer;
|
||||||
|
|
||||||
|
// phone number
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=12)
|
||||||
|
*/
|
||||||
|
protected $phone_number;
|
||||||
|
|
||||||
|
// confirm code that we send via SMS
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="string", length=6)
|
||||||
|
*/
|
||||||
|
protected $confirm_code;
|
||||||
|
|
||||||
|
// is confirmed?
|
||||||
|
/**
|
||||||
|
*@ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
protected $confirm_flag;
|
||||||
|
|
||||||
// date the session id was generated and sent to mobile app
|
// date the session id was generated and sent to mobile app
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime")
|
||||||
*/
|
*/
|
||||||
protected $date_generated;
|
protected $date_generated;
|
||||||
|
|
||||||
|
// date the phone number was confirmed
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $date_confirmed;
|
||||||
|
|
||||||
// TODO: get the details we can recover from the phone
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// default date generated to now
|
// default date generated to now
|
||||||
|
$this->id = $this->generateKeyID();
|
||||||
$this->date_generated = new DateTime();
|
$this->date_generated = new DateTime();
|
||||||
|
$this->customer = null;
|
||||||
|
$this->confirm_flag = false;
|
||||||
|
$this->date_confirmed = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateKeyID()
|
||||||
|
{
|
||||||
|
// use uniqid for now, since primary key dupes will trigger exceptions
|
||||||
|
return uniqid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneModel($model)
|
||||||
|
{
|
||||||
|
$this->phone_model = $model;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneModel()
|
||||||
|
{
|
||||||
|
return $this->phone_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setOSType($type)
|
||||||
|
{
|
||||||
|
$this->os_type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOSType()
|
||||||
|
{
|
||||||
|
return $this->os_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setOSVersion($version)
|
||||||
|
{
|
||||||
|
$this->os_version = $version;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOSVersion()
|
||||||
|
{
|
||||||
|
return $this->os_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDevicePushID($id)
|
||||||
|
{
|
||||||
|
$this->device_push_id = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDevicePushID()
|
||||||
|
{
|
||||||
|
return $this->device_push_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCustomer(Customer $cust = null)
|
||||||
|
{
|
||||||
|
$this->customer = $cust;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomer()
|
||||||
|
{
|
||||||
|
return $this->customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateGenerated()
|
||||||
|
{
|
||||||
|
return $this->date_generated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneNumber($num)
|
||||||
|
{
|
||||||
|
$this->phone_number = $num;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneNumber()
|
||||||
|
{
|
||||||
|
return $this->phone_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setConfirmCode($code)
|
||||||
|
{
|
||||||
|
$this->confirm_code = $code;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfirmCode()
|
||||||
|
{
|
||||||
|
return $this->confirm_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setConfirmed($flag = true)
|
||||||
|
{
|
||||||
|
$this->confirm_flag = $flag;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isConfirmed()
|
||||||
|
{
|
||||||
|
return $this->confirm_flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateConfirm(DateTime $date)
|
||||||
|
{
|
||||||
|
$this->date_confirmed = $date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateConfirm()
|
||||||
|
{
|
||||||
|
return $this->date_confirmed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue