diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index f65f0c23..6d5e295a 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -1863,12 +1863,18 @@ class APIController extends Controller $warranty_results = $em->getRepository(Warranty::class)->findBy(['plate_number' => $plate_number], ['date_create' => 'desc']); + $warr = []; + // check if warranty_results is empty if (empty($warranty_results)) { + /* $res->setError(true) ->setErrorMessage('No warranty found for plate number'); return $res->getReturnResponse(); + */ + + return $warr; } // get first entry @@ -1897,7 +1903,6 @@ class APIController extends Controller $expiry_date = $warranty->getDateExpire()->format("d M Y g:i A"); } - $warr = []; $warr[] = [ 'id' => $warranty->getID(), 'serial' => $warranty->getSerial(),