At this moment I am implementing validation using the Symfony Validator component using Annotations in my Entity class.
The Symfony documentation shows you can use certain placeholders to pass variables through a message and these messages can be translated by the Translator component.
So for example, it's possible to write the following annotation:
/**
* Assert\Length(
* min = 5,
* max = 10,
* minMessage = "Title too short: {{ limit }}",
* maxMessage = "Title too long: {{ limit }}"
*/
protected $title;
This works fine, but I was wondering what kinds of placeholders are available to you? Is it possible to create custom placeholders?
I know that the {{ value }} placeholder exists (and works), but it's not on the documentation page of Symfony on how to use the Length validation.
I would like to use a placeholder tag like {{ key }} or {{ name }} to pass through the technical name of the field (in this case "title"), so i can write my minMessage as minMessage = "{{ field }} too short: {{ limit }}"
I tried to check the standard components for Symfony to see how these placeholders are handled, but I cannot find a proper list of variables that are available to me.
Please help me! T_T