$amountTypes */ $amountTypes = []; /** @var \Modules\InvestmentManagement\Controller\ApiController $module */ $module = $app->moduleManager->get('InvestmentManagement', 'Api'); /** @var array $type */ foreach ($types as $type) { $response = new HttpResponse(); $request = new HttpRequest(); $request->header->account = 1; $request->setData('name', $type['name'] ?? ''); $request->setData('content', \reset($type['l11n'])); $request->setData('language', \array_keys($type['l11n'])[0] ?? 'en'); $module->apiAmountTypeCreate($request, $response); $responseData = $response->getData(''); if (!\is_array($responseData)) { continue; } $amountTypes[$type['name']] = \is_array($responseData['response']) ? $responseData['response'] : $responseData['response']->toArray(); $isFirst = true; foreach ($type['l11n'] as $language => $l11n) { if ($isFirst) { $isFirst = false; continue; } $response = new HttpResponse(); $request = new HttpRequest(); $request->header->account = 1; $request->setData('content', $l11n); $request->setData('language', $language); $request->setData('ref', $amountTypes[$type['name']]['id']); $module->apiAmountTypeL11nCreate($request, $response); } } return $amountTypes; } }