Fix findWarranty bug in API controller #232
This commit is contained in:
parent
53c9964fe3
commit
b87242e356
1 changed files with 6 additions and 1 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue