Modify queries to only get active batteries. #733

This commit is contained in:
Korina Cordero 2023-02-02 03:59:21 +00:00
parent c478a4d0bf
commit cbf5d12d96
3 changed files with 3 additions and 3 deletions

View file

@ -270,7 +270,7 @@ class BatteryManufacturerController extends Controller
// get row data // get row data
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$all_batts = $em->getRepository(Battery::class)->findAll(); $all_batts = $em->getRepository(Battery::class)->findBy(['flag_active' => true]);
foreach ($all_batts as $battery) foreach ($all_batts as $battery)
{ {

View file

@ -1043,7 +1043,7 @@ class RiderAppController extends APIController
if ($rider == null) if ($rider == null)
return new APIResponse(false, 'No rider found.'); return new APIResponse(false, 'No rider found.');
$batts = $em->getRepository(Battery::class)->findAll(); $batts = $em->getRepository(Battery::class)->findBy(['flag_active' => true]);
$models = $em->getRepository(BatteryModel::class)->findAll(); $models = $em->getRepository(BatteryModel::class)->findAll();
$sizes = $em->getRepository(BatterySize::class)->findAll(); $sizes = $em->getRepository(BatterySize::class)->findAll();

View file

@ -485,7 +485,7 @@ class VehicleController extends Controller
// get row data // get row data
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$vobj = $em->getRepository(Vehicle::class)->find($req->request->get('vehicle_id')); $vobj = $em->getRepository(Vehicle::class)->find($req->request->get('vehicle_id'));
$all_batts = $em->getRepository(Battery::class)->findAll(); $all_batts = $em->getRepository(Battery::class)->findBy('flag_active' => true);
if (empty($vobj)) if (empty($vobj))
throw $this->createNotFoundException('The item does not exist'); throw $this->createNotFoundException('The item does not exist');