/**
  * @param LocaleInterface $locale
  * @param LocaleIntegrity $constraint
  */
 private function validateLastLocale(LocaleInterface $locale, LocaleIntegrity $constraint)
 {
     $locales = $this->localeProvider->getRequiredLocales();
     if (count($locales) === 1 && reset($locales) === $locale) {
         if (!$locale->isEnabled()) {
             $this->context->buildViolation($constraint->lastEnabledMessage)->atPath('enabled')->addViolation();
         }
         if (!$locale->isRequired()) {
             $this->context->buildViolation($constraint->lastRequiredMessage)->atPath('required')->addViolation();
         }
     }
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function getRequiredLocales()
 {
     return array_map($this->getCallback(), $this->localeProvider->getRequiredLocales());
 }