Merge branch '537-add-container-size-to-battery-information' into 'master'

Resolve "Add container size to battery information"

Closes #537

See merge request jankstudio/resq!628
This commit is contained in:
Kendrick Chan 2021-02-12 04:14:20 +00:00
commit 9f44148e1a

View file

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