resq/src/Entity/CustomerDeleteRequest.php
2023-08-11 07:26:49 +08:00

209 lines
4.1 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use DateTime;
/**
* @ORM\Entity
* @ORM\Table(name="customer_delete_request")
*/
class CustomerDeleteRequest
{
// unique id
/**
* @ORM\Id
* @ORM\Column(type="string", length=50)
*/
protected $id;
// phone number
/**
* @ORM\Column(type="string", length=12)
*/
protected $phone_number;
// reason for account deletion
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $reason;
// confirm code that we send via SMS
/**
* @ORM\Column(type="string", length=6, nullable=true)
*/
protected $confirm_code;
// if this request has been confirmed via SMS
/**
* @ORM\Column(type="boolean")
*/
protected $flag_confirmed;
// if this request has been completed
/**
* @ORM\Column(type="boolean")
*/
protected $flag_completed;
// date request was created
/**
* @ORM\Column(type="datetime")
*/
protected $date_created;
// date and time that the confirmation code was last sent
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $date_code_sent;
// date request was confirmed
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $date_confirmed;
// date customer was created
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $date_completed;
// link to customer
/**
* @ORM\ManyToOne(targetEntity="Customer")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
*/
protected $customer;
public function __construct()
{
$this->id = $this->generateKeyID();
$this->flag_confirmed = false;
$this->flag_completed = false;
$this->date_created = new DateTime();
$this->date_code_sent = null;
$this->date_confirmed = null;
$this->date_completed = null;
$this->reason = null;
$this->customer = null;
}
public function generateKeyID()
{
// use uniqid with unix timestamp prefix for now
return uniqid(time());
}
public function getID()
{
return $this->id;
}
public function setPhoneNumber($num)
{
$this->phone_number = $num;
return $this;
}
public function getPhoneNumber()
{
return $this->phone_number;
}
public function setReason($reason)
{
$this->reason = $reason;
return $this;
}
public function getReason()
{
return $this->reason;
}
public function setConfirmCode($code)
{
$this->confirm_code = $code;
return $this;
}
public function getConfirmCode()
{
return $this->confirm_code;
}
public function setConfirmed($flag = true)
{
$this->flag_confirmed = $flag;
return $this;
}
public function isConfirmed()
{
return $this->flag_confirmed;
}
public function setCompleted($flag = true)
{
$this->flag_completed = $flag;
return $this;
}
public function isCompleted()
{
return $this->flag_completed;
}
public function getDateCreated()
{
return $this->date_created;
}
public function setDateCodeSent(DateTime $date)
{
$this->date_code_sent = $date;
return $this;
}
public function getDateCodeSent()
{
return $this->date_code_sent;
}
public function setDateConfirmed(DateTime $date)
{
$this->date_confirmed = $date;
return $this;
}
public function getDateConfirmed()
{
return $this->date_confirmed;
}
public function setDateCompleted(DateTime $date)
{
$this->date_completed = $date;
return $this;
}
public function getDateCompleted()
{
return $this->date_completed;
}
public function setCustomer(Customer $cust = null)
{
$this->customer = $cust;
return $this;
}
public function getCustomer()
{
return $this->customer;
}
}