public function intCreateUnitsAction(Request $request)
{
if (!$this->ensureAuthKey($request)) {
return $this->getAuthKeyErrorResponse();
}
$response = ['success' => true, 'errors' => [], 'message' => 'Default units successfully created/updated'];
try {
$this->get('partkeepr.setup.unit_service')->importUnits();
} catch (\Exception $e) {
$response['success'] = false;
$response['message'] = 'Unit creation error';
$response['errors'] = [$e->getMessage()];
}
return new JsonResponse($response);
}