Skip to content

[Validator] Using TranslateableMessage with ExecutionContext::buildViolation #19704

@SebTM

Description

@SebTM

Regarding: https://symfony.com/doc/current/validation/translations.html
From: #19054 (comment)

From my experience in a project where I tried to use it like that it failed as the type declaration only allows "string" (https://github.com/symfony/validator/blob/6.4/Context/ExecutionContext.php#L157C21-L157C35) or so I miss something here?

Even TranslateableMessage implements "__toString" does not help as it would only return the template-message without resolving/translating it. (https://github.com/symfony/translation/blob/6.4/TranslatableMessage.php#L35)

I checked it for the version I used (6.4) but it seems to be the same for 7.X - if I missed something maybe we can clarify the example 🙏🏻

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy