From d1104b7416bc61b8d6e1f5a318b4eadddd11ae66 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Sat, 26 Oct 2024 03:40:32 +0800 Subject: [PATCH] Change unfulfilled subscriptions endpoint to retrieve vehicle data and not just a count #799 --- src/Controller/CustomerAppAPI/SubscriptionController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Controller/CustomerAppAPI/SubscriptionController.php b/src/Controller/CustomerAppAPI/SubscriptionController.php index b8396649..a45bd992 100644 --- a/src/Controller/CustomerAppAPI/SubscriptionController.php +++ b/src/Controller/CustomerAppAPI/SubscriptionController.php @@ -291,8 +291,10 @@ class SubscriptionController extends ApiController // NOTE: this functions like an outer join as far as DQL is concerned // get all customer vehicles for the current customer that do not have a JO - $sql = 'SELECT COUNT(cv.id) AS count + $sql = 'SELECT cv.id, cv.name, cv.model_year, cv.plate_number, v.id AS make_id, v.make AS make, vm.name AS manufacturer FROM App\Entity\CustomerVehicle cv + JOIN App\Entity\Vehicle v WITH cv.vehicle = v + JOIN App\Entity\VehicleManufacturer vm WITH v.manufacturer = vm JOIN App\Entity\Subscription s WITH s.customer_vehicle = cv AND s.status = :status LEFT JOIN App\Entity\JobOrder jo WITH jo.subscription = s WHERE jo.id IS NULL @@ -304,11 +306,11 @@ class SubscriptionController extends ApiController 'customer' => $cust, ]); - $count = $query->getSingleScalarResult(); + $vehicles = $query->getResult(); // response return new ApiResponse(true, '', [ - 'count' => $count, + 'vehicles' => $vehicles, ]); }