lephare/doctrine-json-translation-bundle

Integrate le-phare/doctrine-json-translation in Symfony

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/lephare/doctrine-json-translation-bundle

dev-main 2026-02-06 15:32 UTC

This package is auto-updated.

Last update: 2026-02-06 15:32:56 UTC


README

License: MIT

Table of Contents

Features

  • Doctrine type to store translations in multiple locales in JSON format
  • Symfony form type to edit translations

Installation

composer require lephare/doctrine-json-translation-bundle

Usage

1. Configure Doctrine

First, you need to register the custom translated type in your Doctrine configuration.

Add this to config/packages/doctrine.yaml:

# config/packages/doctrine.yaml
doctrine:
    dbal:
        types: LePhare\DoctrineJsonTranslation\DBAL\TranslatedType

2. Use in an entity

#[ORM\Column(type: 'translated')]
protected TranslatedField $title;

3. Use in a form

use LePhare\DoctrineJsonTranslation\Form\Type\TranslatedType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class ExampleType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('title', TranslatedType::class)
        ;
    }
}