Skip to content

Missing Translatable annotations: Reduce RuntimeException to log message? #14

@MalteWunsch

Description

@MalteWunsch

The RuntimeException thrown in

throw new RuntimeException('No translatable attributes annotated with @Polyglot\Translatable were found');
seem to harsh to me.

Sometimes I want to deploy some preparation for translations (namely the *Translatable entity and it's migration) early, so that the migration is executed in the production database and clients can start translating content, before the code is fully functioning. When I do the preparation lazily, I might add @Polyglot\Locale at the class level, but miss to @Polyglot\Translatable at the appripriate attributes - and don't think twice about it, as I know the code does not need to work right now. This results in the RuntimeException.

Having missed adding an annotation is nothing I would expect to result in a RuntimeException. If there are no appropriate tests, this might slip through into production.

Hence I think about reducing this RuntimeException to a log message. If I don't get a translation as expected, the logs might be one of the last places I would look at, but the entity attribute or the README instructions of this bundle seem to be reasonable as first points of contact, so this might be enough?

WDYT, @mpdude @FabianSchmick ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions