Class

eZ\Publish\Core\REST\Client\LanguageService

class LanguageService implements LanguageService, Sessionable

Implementation of the {@link \eZ\Publish\API\Repository\LanguageService} interface.

Methods

__construct(ContentService $contentService, $defaultLanguageCode, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)

setSession(mixed $id)

Set session ID.

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 63
public __construct(ContentService $contentService, $defaultLanguageCode, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser)

Parameters

ContentService $contentService
$defaultLanguageCode
HttpClient $client
Dispatcher $inputDispatcher
Visitor $outputVisitor
RequestParser $requestParser

at line 82
public setSession(mixed $id)

Set session ID.

Only for testing

Parameters

mixed $id tringid

at line 99
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 114
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 126
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 138
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 152
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 162
public Language[] loadLanguages()

Loads all Languages.

Return Value

Language[]

at line 176
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 191
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 does not have access to content translations

at line 201
public string getDefaultLanguageCode()

Returns a configured default language code.

Return Value

string

at line 211
public LanguageCreateStruct newLanguageCreateStruct()

Instantiates an object to be used for creating languages.

Return Value

LanguageCreateStruct