TranslationsManager
class TranslationsManager implements BasicEntityManagerInterface
Class TranslationsManager is injected as empire_product_translations_plugin.product_translations_manager service. TranslationsManager handles the logic for managed entity.
Traits
Constants
| PRODUCT_TRANSLATION_DOMAIN |
Domain for saving product entities |
| CATEGORY_TRANSLATION_DOMAIN |
Domain for saving category entities |
| ATTRIBUTES_TRANSLATION_DOMAIN |
Domain for saving attributes and attribute values entities |
| ATTRIBUTE_SET_TRANSLATION_DOMAIN |
Domain for saving attribute set entities |
| BRAND_TRANSLATION_DOMAIN |
Domain for saving brand entities |
Methods
Generate new translations for product entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
Generate new translations for category entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
Generate new translations for brand entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
Generate new translations for attribute entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
Generate new translations for attribute set entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
Updating product translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on ProductTranslation entity
Updating category translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on CategoryTranslation entity
Updating attribute set translations All translations are saved to corresponding yml files
Updating attribute translations All translations are saved to corresponding yml files
Updating attribute value translations All translations are saved to corresponding yml files
Updating brand translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on BrandTranslation entity
Updating product seo translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on ProductTranslation entity
TranslationsManager constructor.
Setting default language to property defaultLanguageLocale It takes value from constant DEFAULT_LANGUAGE_LOCALE if it defined, otherwise it query database for default language locale
Find all available languages(as array) from cache
Find all messages
Save multiple translation entities
Update database translation
Generates translations from entities to appropriate yml file
Send signal to cache categories again, because of changed of translations
Saving multiple product translations.
Saving multiple brand translations.
Saving multiple category translations.
Find single product translation entity. Used for saving/updating translations
Find single brand translation entity. Used for saving/updating translations
Find single category translation entity. Used for saving/updating translations
No description
Return product reference for provided id
Return brand reference for provided id
Return category reference for provided id
Used to invalidate and generate cache for 'Lexik bundle'
No description
Remove cached translations. Both symfony and bazinga translations
Update seo fields on product if translations for default locale has changed
Update basic fields(name, description, short description and permalink) on product if translations for default locale has changed
Update basic and seo fields on category if translations for default locale has changed
Update basic and seo fields on brand if translations for default locale has changed
Details
in SaveNewTranslationTrait at line 31
generateNewTranslation(Product $product)
Generate new translations for product entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
in SaveNewTranslationTrait at line 59
generateNewCategoryTranslation(Category $category)
Generate new translations for category entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
in SaveNewTranslationTrait at line 90
generateNewBrandTranslation(Brand $brand)
Generate new translations for brand entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
in SaveNewTranslationTrait at line 120
generateNewAttrTranslation(Attribute $attr)
Generate new translations for attribute entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
in SaveNewTranslationTrait at line 149
generateNewAttrSetTranslation(AttributeSet $attrSet)
Generate new translations for attribute set entity - Only generate yml translations for default language locale Changing translations for other languages is done on edit
in UpdateTranslationTrait at line 39
array
updateProductTranslations(stdClass $content)
Updating product translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on ProductTranslation entity
in UpdateTranslationTrait at line 112
array
updateCategoryTranslations(stdClass $content)
Updating category translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on CategoryTranslation entity
in UpdateTranslationTrait at line 188
array
updateAttrSetTranslation(stdClass $content)
Updating attribute set translations All translations are saved to corresponding yml files
in UpdateTranslationTrait at line 225
array
updateAttrTranslation(stdClass $content)
Updating attribute translations All translations are saved to corresponding yml files
in UpdateTranslationTrait at line 259
updateAttrValueTranslation(array $content)
Updating attribute value translations All translations are saved to corresponding yml files
in UpdateTranslationTrait at line 297
array
updateBrandTranslation(stdClass $content)
Updating brand translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on BrandTranslation entity
in UpdateTranslationTrait at line 376
array
updateProductSeoTranslations(stdClass $content)
Updating product seo translations All translations are saved to corresponding yml files Translations are saved on entity for default language, otherwise on ProductTranslation entity
at line 107
__construct(TranslationsRepository $translationsRepository, string $projectRootDir, ContainerInterface $container)
TranslationsManager constructor.
at line 118
checkDefaultLanguageLocale()
Setting default language to property defaultLanguageLocale It takes value from constant DEFAULT_LANGUAGE_LOCALE if it defined, otherwise it query database for default language locale
at line 135
array
getAllAvailableLanguages()
Find all available languages(as array) from cache
at line 145
array
findAllMessagesTranslations()
Find all messages
at line 157
saveMultipleMessagesTranslations(array $dbTranslations)
Save multiple translation entities
at line 171
updateMessageTranslation(string $key, string $value, int $languageId)
Update database translation
at line 185
generateEntityTranslations(array $content)
Generates translations from entities to appropriate yml file
at line 205
dispatchTeeGenerateSignal()
Send signal to cache categories again, because of changed of translations
at line 220
bool
saveMultipleProductTranslations(array $productArray)
Saving multiple product translations.
at line 232
bool
saveMultipleBrandTranslations(array $brandArray)
Saving multiple brand translations.
at line 244
bool
saveMultipleCategoryTranslations(array $categoryArray)
Saving multiple category translations.
at line 257
mixed|null
findSingleTranslation(int $productId, string $locale)
Find single product translation entity. Used for saving/updating translations
at line 270
mixed|null
findSingleBrandTranslation(int $brandId, string $locale)
Find single brand translation entity. Used for saving/updating translations
at line 283
mixed|null
findSingleCategoryTranslation(int $categoryId, string $locale)
Find single category translation entity. Used for saving/updating translations
at line 295
checkPermalinkForEntity(string $entityType, int $id, array $allPermalink)
at line 320
bool|Proxy|null|object
getReferenceForProduct(int $productId)
Return product reference for provided id
at line 332
bool|Proxy|null|object
getReferenceForBrand(int $productId)
Return brand reference for provided id
at line 344
bool|Proxy|null|object
getReferenceForCategory(int $categoryId)
Return category reference for provided id
at line 352
invalidateAndGenerateCache()
Used to invalidate and generate cache for 'Lexik bundle'
at line 372
mixed
updateTranslationsForEntity(mixed $content)
at line 388
removeCachedTranslations()
Remove cached translations. Both symfony and bazinga translations
at line 403
updateProductSeo(Product $product)
Update seo fields on product if translations for default locale has changed
at line 413
updateProductFields(Product $product)
Update basic fields(name, description, short description and permalink) on product if translations for default locale has changed
at line 423
updateCategoryFields(Category $category)
Update basic and seo fields on category if translations for default locale has changed
at line 435
updateBrandFields(Brand $brand)
Update basic and seo fields on brand if translations for default locale has changed