Skip to content

Automatically add translation when it does not exist #55

@rsereir

Description

@rsereir

Hello,

I have an entity without any translation and i see in my Symfony profiler multiple requests to query current locale, and default locale, then if no translation, insert new translation.

The problem is i don't want to add new translation automatically.

I think, when i call $this->getTranslations('unavailable locale')->getName(), i have a new translation object created with name = null but with a $entityManager->flush() for other reasons after this getTranslations(), this object is persisted to database.

This is my error:
An exception occurred while executing a query: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column \"template\" of relation \"email_translation\" violates not-null constraint\nDETAIL: Failing row contains (1ecd36ca-d8ef-6572-bb2a-c1eda6aadb28, 1ecd23cc-a924-61aa-8575-d1e3b0741a73, fr, null).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions