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

Class SaveNewTranslationTrait Trait responsible for saving new translations
Trait UpdateTranslationTraitNew Trait responsible for updating existing translations
Trait DeleteTranslationTrait Trait responsible for deleting translations

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

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

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

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

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

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

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

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

array
updateAttrSetTranslation(stdClass $content)

Updating attribute set translations All translations are saved to corresponding yml files

array
updateAttrTranslation(stdClass $content)

Updating attribute translations All translations are saved to corresponding yml files

updateAttrValueTranslation(array $content)

Updating attribute value translations All translations are saved to corresponding yml files

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

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

__construct(TranslationsRepository $translationsRepository, string $projectRootDir, ContainerInterface $container)

TranslationsManager constructor.

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

array
getAllAvailableLanguages()

Find all available languages(as array) from cache

array
findAllMessagesTranslations()

Find all messages

saveMultipleMessagesTranslations(array $dbTranslations)

Save multiple translation entities

updateMessageTranslation(string $key, string $value, int $languageId)

Update database translation

generateEntityTranslations(array $content)

Generates translations from entities to appropriate yml file

dispatchTeeGenerateSignal()

Send signal to cache categories again, because of changed of translations

bool
saveMultipleProductTranslations(array $productArray)

Saving multiple product translations.

bool
saveMultipleBrandTranslations(array $brandArray)

Saving multiple brand translations.

bool
saveMultipleCategoryTranslations(array $categoryArray)

Saving multiple category translations.

mixed|null
findSingleTranslation(int $productId, string $locale)

Find single product translation entity. Used for saving/updating translations

mixed|null
findSingleBrandTranslation(int $brandId, string $locale)

Find single brand translation entity. Used for saving/updating translations

mixed|null
findSingleCategoryTranslation(int $categoryId, string $locale)

Find single category translation entity. Used for saving/updating translations

checkPermalinkForEntity(string $entityType, int $id, array $allPermalink)

No description

bool|Proxy|null|object
getReferenceForProduct(int $productId)

Return product reference for provided id

bool|Proxy|null|object
getReferenceForBrand(int $productId)

Return brand reference for provided id

bool|Proxy|null|object
getReferenceForCategory(int $categoryId)

Return category reference for provided id

invalidateAndGenerateCache()

Used to invalidate and generate cache for 'Lexik bundle'

mixed
updateTranslationsForEntity(mixed $content)

No description

removeCachedTranslations()

Remove cached translations. Both symfony and bazinga translations

updateProductSeo(Product $product)

Update seo fields on product if translations for default locale has changed

updateProductFields(Product $product)

Update basic fields(name, description, short description and permalink) on product if translations for default locale has changed

updateCategoryFields(Category $category)

Update basic and seo fields on category if translations for default locale has changed

updateBrandFields(Brand $brand)

Update basic and seo fields on brand if translations for default locale has changed

Details

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

Parameters

Product $product

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

Parameters

Category $category

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

Parameters

Brand $brand

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

Parameters

Attribute $attr

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

Parameters

AttributeSet $attrSet

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

Parameters

stdClass $content

Return Value

array

See also

ProductTranslation

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

Parameters

stdClass $content

Return Value

array

See also

CategoryTranslation

in UpdateTranslationTrait at line 188
array updateAttrSetTranslation(stdClass $content)

Updating attribute set translations All translations are saved to corresponding yml files

Parameters

stdClass $content

Return Value

array

in UpdateTranslationTrait at line 225
array updateAttrTranslation(stdClass $content)

Updating attribute translations All translations are saved to corresponding yml files

Parameters

stdClass $content

Return Value

array

in UpdateTranslationTrait at line 259
updateAttrValueTranslation(array $content)

Updating attribute value translations All translations are saved to corresponding yml files

Parameters

array $content

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

Parameters

stdClass $content

Return Value

array

Exceptions

Exception

See also

BrandTranslation

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

Parameters

stdClass $content

Return Value

array

See also

ProductTranslation

at line 107
__construct(TranslationsRepository $translationsRepository, string $projectRootDir, ContainerInterface $container)

TranslationsManager constructor.

Parameters

TranslationsRepository $translationsRepository
string $projectRootDir
ContainerInterface $container

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

Return Value

array

at line 145
array findAllMessagesTranslations()

Find all messages

Return Value

array

at line 157
saveMultipleMessagesTranslations(array $dbTranslations)

Save multiple translation entities

Parameters

array $dbTranslations

Exceptions

Exception

at line 171
updateMessageTranslation(string $key, string $value, int $languageId)

Update database translation

Parameters

string $key
string $value
int $languageId

Exceptions

DBALException

at line 185
generateEntityTranslations(array $content)

Generates translations from entities to appropriate yml file

Parameters

array $content

Exceptions

Exception

See also

GenerateTranslationsForEntitiesCommand

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.

Parameters

array $productArray

Return Value

bool FALSE on error, otherwise TRUE

at line 232
bool saveMultipleBrandTranslations(array $brandArray)

Saving multiple brand translations.

Parameters

array $brandArray

Return Value

bool FALSE on error, otherwise TRUE

at line 244
bool saveMultipleCategoryTranslations(array $categoryArray)

Saving multiple category translations.

Parameters

array $categoryArray

Return Value

bool FALSE on error, otherwise TRUE

at line 257
mixed|null findSingleTranslation(int $productId, string $locale)

Find single product translation entity. Used for saving/updating translations

Parameters

int $productId
string $locale

Return Value

mixed|null

at line 270
mixed|null findSingleBrandTranslation(int $brandId, string $locale)

Find single brand translation entity. Used for saving/updating translations

Parameters

int $brandId
string $locale

Return Value

mixed|null

at line 283
mixed|null findSingleCategoryTranslation(int $categoryId, string $locale)

Find single category translation entity. Used for saving/updating translations

Parameters

int $categoryId
string $locale

Return Value

mixed|null

at line 295
checkPermalinkForEntity(string $entityType, int $id, array $allPermalink)

Parameters

string $entityType
int $id
array $allPermalink

Exceptions

PermalinkAlreadyDefinedException

at line 320
bool|Proxy|null|object getReferenceForProduct(int $productId)

Return product reference for provided id

Parameters

int $productId

Return Value

bool|Proxy|null|object

at line 332
bool|Proxy|null|object getReferenceForBrand(int $productId)

Return brand reference for provided id

Parameters

int $productId

Return Value

bool|Proxy|null|object

at line 344
bool|Proxy|null|object getReferenceForCategory(int $categoryId)

Return category reference for provided id

Parameters

int $categoryId

Return Value

bool|Proxy|null|object

at line 352
invalidateAndGenerateCache()

Used to invalidate and generate cache for 'Lexik bundle'

at line 372
mixed updateTranslationsForEntity(mixed $content)

Parameters

mixed $content

Return Value

mixed

Exceptions

Exception

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

Parameters

Product $product

at line 413
updateProductFields(Product $product)

Update basic fields(name, description, short description and permalink) on product if translations for default locale has changed

Parameters

Product $product

at line 423
updateCategoryFields(Category $category)

Update basic and seo fields on category if translations for default locale has changed

Parameters

Category $category

at line 435
updateBrandFields(Brand $brand)

Update basic and seo fields on brand if translations for default locale has changed

Parameters

Brand $brand

Exceptions

Exception