Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
eZ\Publish\Core\Repository\LanguageService Class Reference

Language service, used for language operations. More...

Inheritance diagram for eZ\Publish\Core\Repository\LanguageService:

## Public Member Functions
| __construct (RepositoryInterface $repository, Handler $languageHandler, array $settings=[])
| Setups service with reference to repository object that created it & corresponding handler. More...
| createLanguage (LanguageCreateStruct $languageCreateStruct)
| Creates the a new Language in the content repository. More...
| updateLanguageName (Language $language, $newName)
| Changes the name of the language in the content repository. More...
| enableLanguage (Language $language)
| Enables a language. More...
| disableLanguage (Language $language)
| Disables a language. More...
| loadLanguage ($languageCode)
| Loads a Language from its language code ($languageCode). More...
| loadLanguages ()
| Loads all Languages. More...
| loadLanguageById ($languageId)
| Loads a Language by its id ($languageId). More...
| loadLanguageListByCode (array $languageCodes)
  | {Bulk-load Languages by language codes.Note: it does not throw exceptions on load, just ignores erroneous Languages. Parameters
  string[] | $languageCodes |
Returns \eZ\Publish\API\Repository\Values\Content\Language[] list of Languages with language-code as keys } More...
| loadLanguageListById (array $languageIds)
  | {Bulk-load Languages by ids.Note: it does not throw exceptions on load, just ignores erroneous Languages. Parameters
  int[] | $languageIds |
Returns \eZ\Publish\API\Repository\Values\Content\Language[] list of Languages with id as keys } More...
| deleteLanguage (Language $language)
| Deletes a language from content repository. More...
| getDefaultLanguageCode ()
| Returns a configured default language code. More...
| getPrioritizedLanguageCodeList ()
| Returns a configured list of prioritized languageCodes. More...
| newLanguageCreateStruct ()
| Instantiates an object to be used for creating languages. More...

## Protected Member Functions
| buildDomainObject (SPILanguage $spiLanguage)
| Builds Language domain object from ValueObject returned by Persistence API. More...

## Protected Attributes
| $repository
| $languageHandler
| $settings

## Detailed Description

Language service, used for language operations.

Definition at line 26 of file Core/Repository/LanguageService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\LanguageService::__construct | ( | RepositoryInterface | $repository,
|  | Handler | $languageHandler,
|  | array | $settings = `[]`
| ) |  |

Setups service with reference to repository object that created it & corresponding handler.

Parameters

  \eZ\Publish\API\Repository\Repository | $repository |
  \eZ\Publish\SPI\Persistence\Content\Language\Handler | $languageHandler |
  array | $settings |

Definition at line 44 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\$languageHandler, eZ\Publish\Core\Repository\LanguageService\$repository, and eZ\Publish\Core\Repository\LanguageService\$settings.

## Member Function Documentation

## ◆ buildDomainObject()

eZ\Publish\Core\Repository\LanguageService::buildDomainObject | ( | SPILanguage | $spiLanguage | ) |
| protected

Builds Language domain object from ValueObject returned by Persistence API.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Language | $spiLanguage |

Returns
  \eZ\Publish\API\Repository\Values\Content\Language

Definition at line 385 of file Core/Repository/LanguageService.php.

Referenced by eZ\Publish\Core\Repository\LanguageService\createLanguage(), eZ\Publish\Core\Repository\LanguageService\loadLanguage(), eZ\Publish\Core\Repository\LanguageService\loadLanguageById(), eZ\Publish\Core\Repository\LanguageService\loadLanguageListByCode(), eZ\Publish\Core\Repository\LanguageService\loadLanguageListById(), and eZ\Publish\Core\Repository\LanguageService\loadLanguages().

## ◆ createLanguage()

eZ\Publish\Core\Repository\LanguageService::createLanguage | ( | LanguageCreateStruct | $languageCreateStruct | ) |

Creates the a new Language in the content repository.

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 64 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject(), and eZ\Publish\Core\Repository\LanguageService\loadLanguage().

## ◆ deleteLanguage()

eZ\Publish\Core\Repository\LanguageService::deleteLanguage | ( | Language | $language | ) |

Deletes a language from content repository.

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 326 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\loadLanguageById().

## ◆ disableLanguage()

eZ\Publish\Core\Repository\LanguageService::disableLanguage | ( | Language | $language | ) |

Disables a language.

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 202 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\loadLanguageById().

## ◆ enableLanguage()

eZ\Publish\Core\Repository\LanguageService::enableLanguage | ( | Language | $language | ) |

Enables a language.

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 164 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\loadLanguageById().

## ◆ getDefaultLanguageCode()

eZ\Publish\Core\Repository\LanguageService::getDefaultLanguageCode | ( |  | ) |

Returns a configured default language code.

Returns
  string

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 352 of file Core/Repository/LanguageService.php.

## ◆ getPrioritizedLanguageCodeList()

eZ\Publish\Core\Repository\LanguageService::getPrioritizedLanguageCodeList | ( |  | ) |

Returns a configured list of prioritized languageCodes.

Returns
  string[]

Definition at line 363 of file Core/Repository/LanguageService.php.

## ◆ loadLanguage()

eZ\Publish\Core\Repository\LanguageService::loadLanguage | ( |  | $languageCode | ) |

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

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 242 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject().

Referenced by eZ\Publish\Core\Repository\LanguageService\createLanguage().

## ◆ loadLanguageById()

eZ\Publish\Core\Repository\LanguageService::loadLanguageById | ( |  | $languageId | ) |

Loads a Language by its id ($languageId).

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 279 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject().

Referenced by eZ\Publish\Core\Repository\LanguageService\deleteLanguage(), eZ\Publish\Core\Repository\LanguageService\disableLanguage(), eZ\Publish\Core\Repository\LanguageService\enableLanguage(), and eZ\Publish\Core\Repository\LanguageService\updateLanguageName().

## ◆ loadLanguageListByCode()

eZ\Publish\Core\Repository\LanguageService::loadLanguageListByCode | ( | array | $languageCodes | ) |

{Bulk-load Languages by language codes.Note: it does not throw exceptions on load, just ignores erroneous Languages.

Parameters

  string[] | $languageCodes |

Returns
  \eZ\Publish\API\Repository\Values\Content\Language[] list of Languages with language-code as keys

}

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 289 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject().

## ◆ loadLanguageListById()

eZ\Publish\Core\Repository\LanguageService::loadLanguageListById | ( | array | $languageIds | ) |

{Bulk-load Languages by ids.Note: it does not throw exceptions on load, just ignores erroneous Languages.

Parameters

  int[] | $languageIds |

Returns
  \eZ\Publish\API\Repository\Values\Content\Language[] list of Languages with id as keys

}

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 304 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject().

## ◆ loadLanguages()

eZ\Publish\Core\Repository\LanguageService::loadLanguages | ( |  | ) |

Loads all Languages.

Returns
  \eZ\Publish\API\Repository\Values\Content\Language[]

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 258 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\buildDomainObject().

## ◆ newLanguageCreateStruct()

eZ\Publish\Core\Repository\LanguageService::newLanguageCreateStruct | ( |  | ) |

Instantiates an object to be used for creating languages.

Returns
  \eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 373 of file Core/Repository/LanguageService.php.

## ◆ updateLanguageName()

eZ\Publish\Core\Repository\LanguageService::updateLanguageName | ( | Language | $language,
|  |  | $newName
| ) |  |

Changes the name of the language in the content repository.

Exceptions

Implements eZ\Publish\API\Repository\LanguageService.

Definition at line 122 of file Core/Repository/LanguageService.php.

References eZ\Publish\Core\Repository\LanguageService\loadLanguageById().

## Member Data Documentation

## ◆ $languageHandler

eZ\Publish\Core\Repository\LanguageService::$languageHandler
| protected

Definition at line 32 of file Core/Repository/LanguageService.php.

Referenced by eZ\Publish\Core\Repository\LanguageService\__construct().

## ◆ $repository

eZ\Publish\Core\Repository\LanguageService::$repository
| protected

Definition at line 29 of file Core/Repository/LanguageService.php.

Referenced by eZ\Publish\Core\Repository\LanguageService\__construct().

## ◆ $settings

eZ\Publish\Core\Repository\LanguageService::$settings
| protected

Definition at line 35 of file Core/Repository/LanguageService.php.

Referenced by eZ\Publish\Core\Repository\LanguageService\__construct().

The documentation for this class was generated from the following file:

- Core/Repository/LanguageService.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.