/** * @param AttributeInterface $attribute * @param array $data */ protected function setAvailableLocales(AttributeInterface $attribute, array $data) { $localeSpecificCodes = $attribute->getLocaleSpecificCodes(); foreach ($data as $localeCode) { if (!in_array($localeCode, $localeSpecificCodes)) { $locale = $this->localeRepository->findOneByIdentifier($localeCode); $attribute->addAvailableLocale($locale); } } }