Class

eZ\Publish\Core\SignalSlot\LanguageService

class LanguageService implements LanguageService

LanguageService class.

Methods

__construct(LanguageService $service, SignalDispatcher $signalDispatcher)

Constructor.

Language createLanguage(LanguageCreateStruct $languageCreateStruct)

Creates the a new Language in the content repository.

Language updateLanguageName(Language $language, string $newName)

Changes the name of the language in the content repository.

Language enableLanguage(Language $language)

Enables a language.

Language disableLanguage(Language $language)

Disables a language.

Language loadLanguage(string $languageCode)

Loads a Language from its language code ($languageCode).

Language[] loadLanguages()

Loads all Languages.

Language loadLanguageById(mixed $languageId)

Loads a Language by its id ($languageId).

deleteLanguage(Language $language)

Deletes a language from content repository.

string getDefaultLanguageCode()

Returns a configured default language code.

LanguageCreateStruct newLanguageCreateStruct()

Instantiates an object to be used for creating languages.

Details

at line 48
public __construct(LanguageService $service, SignalDispatcher $signalDispatcher)

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters

LanguageService $service
SignalDispatcher $signalDispatcher

at line 64
public Language createLanguage(LanguageCreateStruct $languageCreateStruct)

Creates the a new Language in the content repository.

Parameters

LanguageCreateStruct $languageCreateStruct

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations
InvalidArgumentException if the languageCode already exists

at line 88
public Language updateLanguageName(Language $language, string $newName)

Changes the name of the language in the content repository.

Parameters

Language $language
string $newName

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations

at line 112
public Language enableLanguage(Language $language)

Enables a language.

Parameters

Language $language

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations

at line 135
public Language disableLanguage(Language $language)

Disables a language.

Parameters

Language $language

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations

at line 158
public Language loadLanguage(string $languageCode)

Loads a Language from its language code ($languageCode).

Parameters

string $languageCode

Return Value

Language

Exceptions

NotFoundException if language could not be found

at line 168
public Language[] loadLanguages()

Loads all Languages.

Return Value

Language[]

at line 182
public Language loadLanguageById(mixed $languageId)

Loads a Language by its id ($languageId).

Parameters

mixed $languageId

Return Value

Language

Exceptions

NotFoundException if language could not be found

at line 197
public deleteLanguage(Language $language)

Deletes a language from content repository.

Parameters

Language $language

Exceptions

InvalidArgumentException if language can not be deleted because it is still assigned to some content / type / (...).
UnauthorizedException If user is not allowed to delete a language

at line 216
public string getDefaultLanguageCode()

Returns a configured default language code.

Return Value

string

at line 226
public LanguageCreateStruct newLanguageCreateStruct()

Instantiates an object to be used for creating languages.

Return Value

LanguageCreateStruct