public function validate(APILimitationValue $limitationValue): array
    {
        $validationErrors = array();
        $existingLanguages = $this->persistenceLanguageHandler->loadListByLanguageCodes(
            $limitationValue->limitationValues
        );
        $missingLanguages = array_diff(
            $limitationValue->limitationValues,
            array_keys($existingLanguages)
        );
        if (!empty($missingLanguages)) {
            $validationErrors[] = new ValidationError(
                "limitationValues[] => '%languageCodes%' translation(s) do not exist",
                null,
                [
                    'languageCodes' => implode(', ', $missingLanguages),
                ]
            );
        }

        return $validationErrors;
    }
public function validate(APILimitationValue $limitationValue): array
    {
        $validationErrors = array();
        $existingLanguages = $this->persistenceLanguageHandler->loadListByLanguageCodes(
            $limitationValue->limitationValues
        );
        $missingLanguages = array_diff(
            $limitationValue->limitationValues,
            array_keys($existingLanguages)
        );
        if (!empty($missingLanguages)) {
            $validationErrors[] = new ValidationError(
                "limitationValues[] => '%languageCodes%' translation(s) do not exist",
                null,
                [
                    'languageCodes' => implode(', ', $missingLanguages),
                ]
            );
        }

        return $validationErrors;
    }
public function validate ( APILimitationValue $ limitationValue ) : array { $ validationErrors = array ( ) ; $ existingLanguages = $ this -> persistenceLanguageHandler -> loadListByLanguageCodes ( $ limitationValue -> limitationValues ) ; $ missingLanguages = array_diff ( $ limitationValue -> limitationValues , array_keys ( $ existingLanguages ) ) ; if ( ! empty ( $ missingLanguages ) ) { $ validationErrors [ ] = new ValidationError ( "limitationValues[] => '%languageCodes%' translation(s) do not exist" , null , [ 'languageCodes' => implode ( ', ' , $ missingLanguages ) , ] ) ; } return $ validationErrors ; }
Makes sure every language code defined as limitation exists.

Make sure {@link acceptValue()} is checked first!

@param \eZ\Publish\API\Repository\Values\User\Limitation $limitationValue

@return \eZ\Publish\SPI\FieldType\ValidationError[]
Makes sure every language code defined as limitation exists .