resq/src/Entity/MobileNumber.php

115 lines
2.3 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use DateTime;
/**
* @ORM\Entity
* @ORM\Table(name="mobile_number")
* @UniqueEntity("id")
* @UniqueEntity("confirm_code")
*/
class MobileNumber
{
// the actual mobile number
// format is "639171112233", no prefix 0, no prefix +
/**
* @ORM\Id
* @ORM\Column(type="string", length=12)
* @Assert\NotBlank()
*/
protected $id;
// customer it belongs to
/**
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="numbers")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
* @Assert\NotBlank()
*/
protected $customer;
// confirm code sent via sms
// should be unique
/**
* @ORM\Column(type="string", length=10, nullable=true, unique=true)
*/
protected $confirm_code;
// date entered into system
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $date_registered;
// is this customer confirmed via sms code already?
/**
* @ORM\Column(type="boolean")
*/
protected $flag_confirmed;
public function __construct()
{
$this->confirm_code = null;
$this->flag_confirmed = false;
}
public function setID($id)
{
$this->id = $id;
return $this;
}
public function getID()
{
return $this->id;
}
public function setCustomer(Customer $customer)
{
$this->customer = $customer;
return $this;
}
public function getCustomer()
{
return $this->customer;
}
public function setConfirmCode($confirm_code)
{
$this->confirm_code = $confirm_code;
return $this;
}
public function getConfirmCode()
{
return $this->confirm_code;
}
public function setDateRegistered(DateTime $date_registered)
{
$this->date_registered = $date_registered;
return $this;
}
public function getDateRegistered()
{
return $this->date_registered;
}
public function setConfirmed($flag_confirmed = true)
{
$this->flag_confirmed = $flag_confirmed;
return $this;
}
public function isConfirmed()
{
return $this->flag_confirmed;
}
}