test fixes

This commit is contained in:
Dennis Eichhorn 2024-04-25 14:29:10 +00:00
parent aa2ef25ebc
commit 5108868776
2 changed files with 6 additions and 4 deletions

View File

@ -101,10 +101,9 @@ final class ApiController extends Controller
// It is a little bit unfortunate that we cannot use attributes but it is what it is.
// Get distributions based on type and stock filter
$stockTypeList = $request->getDataList('types') ?? [];
$stockList = $request->getDataList('stocks') ?? [];
$stockTypeList = $request->getDataList('types');
$stockList = $request->getDataList('stocks');
$stocks = [];
$stockMapper = StockMapper::getAll()
->with('locations')
->with('locations/type')
@ -118,6 +117,9 @@ final class ApiController extends Controller
$stockMapper->where('id', $stockList);
}
/** @var \Modules\WarehouseManagement\Models\Stock[] $stocks */
$stocks = $stockMapper->executeGetArray();
foreach ($stocks as $idx => $stock) {
if (empty($stock->locations)) {
unset($stocks[$idx]);

View File

@ -25,7 +25,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Stock
* @template T of StockTaking
* @extends DataMapperFactory<T>
*/
final class StockTakingMapper extends DataMapperFactory