if (!
$role) { throw new ApiException\
CustomValidationException(sprintf('Role by name %s not found',
$data['role'
]));
} $data['role'
] =
$role;
} else { unset($data['role'
]);
} // Check if a locale id or name is passed.
if (!
empty($data['localeId'
])) { if (!
$this->
isLocaleId((int) $data['localeId'
])) { throw new ApiException\
CustomValidationException(sprintf('Locale by id %s not found',
$data['localeId'
]));
} } elseif (!
empty($data['locale'
])) { $localeId =
$this->
getLocaleIdFromLocale($data['locale'
]);
if (!
$localeId) { throw new ApiException\
CustomValidationException(sprintf('Locale by name %s not found',
$data['locale'
]));
} $data['localeId'
] =
$localeId;
} else { unset($data['locale'
]);
}