The symfony documentation offers two ways: write annotations to the model, which is not appropriate, because if data comes without some kind of field, it will not come to validation and you will have to manually check all the fields, which makes this method meaningless, and create the form as a separate file and substitute in the template, which is also inconvenient.