Link tickets to job order #21

This commit is contained in:
Ramon Gutierrez 2018-02-26 17:52:10 +08:00
parent 4aee9f8cde
commit 7b39419710
2 changed files with 29 additions and 0 deletions

View file

@ -173,6 +173,12 @@ class JobOrder
*/ */
protected $cancel_reason; protected $cancel_reason;
// tickets associated with job order
/**
* @ORM\OneToMany(targetEntity="Ticket", mappedBy="job_order")
*/
protected $tickets;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -435,4 +441,9 @@ class JobOrder
{ {
return $this->cancel_reason; return $this->cancel_reason;
} }
public function getTickets()
{
return $this->tickets;
}
} }

View file

@ -103,6 +103,13 @@ class Ticket
*/ */
protected $customer; protected $customer;
// job order associated with the ticket (optional)
/**
* @ORM\ManyToOne(targetEntity="JobOrder", inversedBy="tickets")
* @ORM\JoinColumn(name="job_order_id", referencedColumnName="id", nullable=true)
*/
protected $job_order;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -260,4 +267,15 @@ class Ticket
{ {
return $this->customer; return $this->customer;
} }
public function setJobOrder(JobOrder $job_order)
{
$this->job_order = $job_order;
return $this;
}
public function getJobOrder()
{
return $this->job_order;
}
} }