PHPackages                             secit-pl/entity-translation-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. secit-pl/entity-translation-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

secit-pl/entity-translation-bundle
==================================

Doctrine entity translations for Symfony.

1.6.3(3y ago)61.4k↓81.3%MITPHPPHP &gt;=7.1.0

Since Jul 2Pushed 2mo agoCompare

[ Source](https://github.com/secit-pl/entity-translation-bundle)[ Packagist](https://packagist.org/packages/secit-pl/entity-translation-bundle)[ Docs](http://secit.pl)[ RSS](/packages/secit-pl-entity-translation-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (11)Versions (16)Used By (0)

Entity Translation Bundle
=========================

[](#entity-translation-bundle)

Doctrine entity translations for Symfony.

Compatibility matrix
--------------------

[](#compatibility-matrix)

Bundle versionMaintainedSymfony versionsMin. PHP version2.xYes7.0 to 8.x8.1.01.6No4.0 to 6.47.1.0Installation
------------

[](#installation)

From the command line run

```
$ composer require secit-pl/entity-translation-bundle

```

Usage
-----

[](#usage)

#### Configuration

[](#configuration)

Open configuration file `./config/packages/entity_translation.yaml`. If file not exists create it.

The file content shoud looks somehting like this:

```
entity_translation:
    locales:
        defined:
          - pl
          - en_GB

        default: '%kernel.default_locale%' # in this example equals `pl`
```

#### Entity

[](#entity)

###### Key rules

[](#key-rules)

- Translatable entity should implements `SecIT\EntityTranslationBundle\Translations\TranslatableInterface`
- Translation entity should be called `Translation` and be placed in namespace same as translatable class name. For example, if translatable entity is `App\Entity\Shop` the translation class should be `App\Entity\Shop\Translation`
- Translation should extends `SecIT\EntityTranslationBundle\Entity\AbstractTranslation`

###### Example

[](#example)

Let's say we have the following entity, and we want to translate the `name` and `description` fields. Other field should not be translated.

./src/Entity/Shop.php

```
