From 8c83393b0cf09470a357548ff89b9dea32298151 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Thu, 24 Oct 2024 06:07:03 +0800 Subject: [PATCH] Add relationship between job order and subscription for tagging #799 --- src/Entity/JobOrder.php | 18 ++++++++++++++++++ src/Entity/Subscription.php | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Entity/JobOrder.php b/src/Entity/JobOrder.php index 885bc295..c6095d05 100644 --- a/src/Entity/JobOrder.php +++ b/src/Entity/JobOrder.php @@ -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; + } } diff --git a/src/Entity/Subscription.php b/src/Entity/Subscription.php index 1906bbf9..2dee6933 100644 --- a/src/Entity/Subscription.php +++ b/src/Entity/Subscription.php @@ -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