DefaultLocalization.php
98 throw new ConfigurationException('No supported language equals the default language \''.$defaultLanguage.'\'');
103 throw new IllegalArgumentException('The translation type \''.$translationType.'\' is unknown.');
117 public function __destruct() {
124 public function getDefaultLanguage() {
132 public function getSupportedLanguages() {
153 public function loadTranslatedObject(ObjectId $oid, $lang, $useDefaults=true) {
162 public function loadTranslation(PersistentObject $object, $lang, $useDefaults=true, $recursive=true, $marker=null) {
164 self::$logger->debug(($marker != null ? strstr($marker, '@').': ' : '')."Load translation [".$lang."] for: ".$object->getOID());
168 // mark already translated objects to avoid infinite recursion (the marker value is based on the initial object)
184 self::$logger->debug(($marker != null ? strstr($marker, '@').': ' : '')."Process relative: ".$relative->getOID());
192 self::$logger->debug(($marker != null ? strstr($marker, '@').': ' : '')."Add relative: ".$relative->getOID());
199 self::$logger->debug(($marker != null ? strstr($marker, '@').': ' : '')."Skip proxy relative: ".$relative->getOID());
220 protected function loadTranslationImpl(PersistentObject $object, $lang, $useDefaults=true) {
248 $translations[$translationInstance->getValue('attribute')] = $translationInstance->getValue('translation');
268 public function saveTranslation(PersistentObject $object, $lang, $recursive=true) {
385 private function setTranslatedValue(PersistentObject $object, $valueName, $translation, $useDefaults) {
387 $isTranslatable = $mapper != null && $mapper->hasAttribute($valueName) ? $mapper->getAttribute($valueName)->hasTag('TRANSLATABLE') : false;
407 private function saveTranslatedValue(PersistentObject $object, $valueName, $existingTranslation, $lang) {
__construct(PersistenceFacade $persistenceFacade, Configuration $configuration, EventManager $eventManager, $defaultLanguage, $translationType, $languageType)
Configuration.
Definition: DefaultLocalization.php:84
EventManager is responsible for dispatching events to registered listeners.
Definition: EventManager.php:21
deleteTranslation(ObjectId $oid, $lang=null)
Definition: DefaultLocalization.php:330
NodeValueIterator is used to iterate over all persistent values of a Node (not including relations).
Definition: NodeValueIterator.php:43
deleteLanguage($lang)
Definition: DefaultLocalization.php:356
IllegalArgumentException signals an exception in method arguments.
Definition: IllegalArgumentException.php:18
setValue($name, $value, $forceSet=false, $trackChange=true)
Set the value of an attribute if it exists.
Criteria defines a condition on a PersistentObject's attribute used to select specific instances.
Definition: Criteria.php:21
ObjectId is the unique identifier of an object.
Definition: ObjectId.php:28
BuildDepth values are used to define the depth when loading object trees.
Definition: BuildDepth.php:19
Implementations of Configuration give access to the application configuration.
Definition: Configuration.php:32
NodeIterator is used to iterate over a tree/list built of Nodes using a Depth-First-Algorithm.
Definition: NodeIterator.php:36
ConfigurationException signals an exception in the configuration.
Definition: ConfigurationException.php:18
afterCreate(PersistenceEvent $event)
Update oids after create.
Definition: DefaultLocalization.php:447
PersistentEvent signals create/update/delete operations on a persistent entity.
Definition: PersistenceEvent.php:22
PersistenceFacade defines the interface for PersistenceFacade implementations.
Definition: PersistenceFacade.php:23
beforeUpdate()
This method is called always before updating the modified object in the store.
saveTranslationImpl(PersistentObject $object, $lang)
Save a translation of a single entity for a specific language.
Definition: DefaultLocalization.php:291
PersistentObjectProxy is proxy for an PersistentObject instance.
Definition: PersistentObjectProxy.php:24
PersistentObject defines the interface of all persistent objects.
Definition: PersistentObject.php:23
LogManager is used to retrieve Logger instances.
Definition: LogManager.php:20
saveTranslation(PersistentObject $object, $lang, $recursive=true)
Definition: DefaultLocalization.php:268
DefaultLocalization is a Localization implementation that saves translations in the store.
Definition: DefaultLocalization.php:58
PersistenceAction values are used to define actions on PersistentObject instances.
Definition: PersistenceAction.php:19
Localization defines the interface for storing localized entity instances and retrieving them back.
Definition: Localization.php:32
ObjectQuery implements a template based object query.
Definition: ObjectQuery.php:106
getSupportedLanguages()
Definition: DefaultLocalization.php:132