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, ]); }