Add container size id and name to battery information. #537

This commit is contained in:
Korina Cordero 2021-02-12 04:01:27 +00:00
parent 870ed4b730
commit 4556c391e3

View file

@ -33,10 +33,20 @@ class BatteryController extends APIController
$result = []; $result = [];
foreach ($batteries as $batt) foreach ($batteries as $batt)
{ {
$csize_id = '';
$csize_name = '';
if ($batt->getContainerSize() != null)
{
$csize_id = $batt->getContainerSize()->getID();
$csize_name = $batt->getContainerSize()->getName();
}
$result[] = [ $result[] = [
'id' => $batt->getID(), 'id' => $batt->getID(),
'size' => $batt->getSize()->getID(), 'size' => $batt->getSize()->getID(),
'brand' => $batt->getBrand()->getID(), 'brand' => $batt->getBrand()->getID(),
'container_size_id' => $csize_id,
'container_size_name' => $csize_name,
'date_update' => $batt->getDateUpdate()->format('YmdHis'), 'date_update' => $batt->getDateUpdate()->format('YmdHis'),
'flag_new' => $batt->isNew(), 'flag_new' => $batt->isNew(),
]; ];