Fix when name is null when returning customer vehicle info. #393

This commit is contained in:
Korina Cordero 2020-04-30 08:08:33 +00:00
parent 13d3cfd3ee
commit ce5a9cb79d

View file

@ -718,21 +718,25 @@ class APIController extends Controller implements LoggedController
$cvs = $cust->getVehicles();
foreach ($cvs as $cv)
{
$battery_id = null;
$battery_id = '';
if ($cv->getCurrentBattery() != null)
$battery_id = $cv->getCurrentBattery()->getID();
$wty_ex = null;
$wty_ex = '';
if ($cv->getWarrantyExpiration() != null)
$wty_ex = $cv->getWarrantyExpiration()->format('Y-m-d');
$warranty = $this->findWarranty($cv->getPlateNumber());
$cv_name = '';
if ($cv->getName() != null)
$cv_name = $cv->getName();
$cv_list[] = [
'cv_id' => $cv->getID(),
'mfg_id' => $cv->getVehicle()->getManufacturer()->getID(),
'make_id' => $cv->getVehicle()->getID(),
'name' => $cv->getName(),
'name' => $cv_name,
'plate_num' => $cv->getPlateNumber(),
'model_year' => $cv->getModelYear(),
'color' => $cv->getColor(),