Add fields and indexes used for search to JO entity. #419
This commit is contained in:
parent
5cdd42e000
commit
c8c03b756d
1 changed files with 89 additions and 1 deletions
|
|
@ -16,7 +16,11 @@ use App\Ramcar\ServiceType;
|
|||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="job_order", indexes={
|
||||
* @ORM\Index(name="date_schedule_idx", columns={"date_schedule"})
|
||||
* @ORM\Index(name="date_schedule_idx", columns={"date_schedule"}),
|
||||
* @ORM\Index(name="plate_number_idx", columns={"plate_number"}),
|
||||
* @ORM\Index(name="first_name_idx", columns={"first_name"}),
|
||||
* @ORM\Index(name="last_name_idx", columns={"last_name"}),
|
||||
* @ORM\Index(name="phone_mobile_idx", columns={"phone_mobile"})
|
||||
* })
|
||||
*/
|
||||
class JobOrder
|
||||
|
|
@ -302,6 +306,34 @@ class JobOrder
|
|||
*/
|
||||
protected $meta;
|
||||
|
||||
// for search purposes
|
||||
// first name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $first_name;
|
||||
|
||||
// last name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $last_name;
|
||||
|
||||
// plate number
|
||||
/**
|
||||
* @ORM\Column(type="string", length=100)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $plate_number;
|
||||
|
||||
// mobile phone
|
||||
/**
|
||||
* @ORM\Column(type="string", length=30)
|
||||
*/
|
||||
protected $phone_mobile;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -322,6 +354,8 @@ class JobOrder
|
|||
|
||||
$this->priority = 0;
|
||||
$this->meta = [];
|
||||
|
||||
$this->phone_mobile = '';
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -865,4 +899,58 @@ class JobOrder
|
|||
return $this->status_autoassign;
|
||||
}
|
||||
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->first_name;
|
||||
}
|
||||
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->last_name;
|
||||
}
|
||||
|
||||
public function setPlateNumber($plate_number)
|
||||
{
|
||||
// make it upper case
|
||||
$plate_number = trim(strtoupper($plate_number));
|
||||
|
||||
// remove spaces
|
||||
$plate_number = str_replace(' ', '', $plate_number);
|
||||
|
||||
// upper case
|
||||
$plate_number = strtoupper($plate_number);
|
||||
|
||||
$this->plate_number = $plate_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlateNumber()
|
||||
{
|
||||
return strtoupper($this->plate_number);
|
||||
}
|
||||
|
||||
public function setPhoneMobile($phone)
|
||||
{
|
||||
$this->phone_mobile = $phone;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhoneMobile()
|
||||
{
|
||||
return $this->phone_mobile;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue