Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set property label with annotations inside an entity

Tags:

symfony

/**
 * @ORM\Column(type="string", length=255)
 * @Assert\NotBlank(message="Please enter your name.")
 * @Assert\Length(
 *     min=3,
 *     max="255",
 *     minMessage="too short.",
 *     maxMessage="too long.",
 * )
 */
protected $name;

The form will show the $name field label as name. Is there a way to define here the field label with annotations?

like image 872
user1566464 Avatar asked Oct 25 '25 20:10

user1566464


1 Answers

No. It's done in the form layer — be it a form type or a form builder using the label option or a Twig form_* function.

like image 72
Elnur Abdurrakhimov Avatar answered Oct 29 '25 06:10

Elnur Abdurrakhimov