Add relationship between job order and subscription for tagging #799

This commit is contained in:
Ramon Gutierrez 2024-10-24 06:07:03 +08:00
parent 3ed65e7fc6
commit 8c83393b0c
2 changed files with 30 additions and 0 deletions

View file

@ -441,6 +441,13 @@ class JobOrder
*/
protected $flag_cust_new;
// get the subscription this job order is associated with
/**
* @ORM\ManyToOne(targetEntity="Subscription", inversedBy="claims")
* @ORM\JoinColumn(name="subscription_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
protected $subscription;
public function __construct()
{
$this->date_create = new DateTime();
@ -1256,4 +1263,15 @@ class JobOrder
return $this->flag_cust_new;
}
public function getSubscription()
{
return $this->subscription;
}
public function setSubscription($subscription)
{
$this->subscription = $subscription;
return $this;
}
}

View file

@ -34,6 +34,12 @@ class Subscription
*/
protected $customer_vehicle;
// job orders associated with subscription
/**
* @ORM\OneToMany(targetEntity="JobOrder", mappedBy="subscription")
*/
protected $job_orders;
// email address
/**
* @ORM\Column(type="string", length=255, nullable=true)
@ -89,6 +95,7 @@ class Subscription
$this->date_start = null;
$this->date_end = null;
$this->date_cancel = null;
$this->job_orders = new ArrayCollection();
$this->metadata = [];
}
@ -207,6 +214,11 @@ class Subscription
return $this->metadata;
}
public function getJobOrders()
{
return $this->job_orders;
}
public function getGatewayTransactions()
{
// TODO: get gateway transactions here via type and metadata