A
A
alex14422015-12-08 00:58:47
MySQL
alex1442, 2015-12-08 00:58:47

How to attach your Entity to Form/Type (Symfony 2.8)?

How to style Type so that when creating a textarea field, the maxlenth attribute is taken from the Assert Length max of the given Entity?
I found an auto-detection for the old version of symfony2
symfony-gu.ru/documentation/ru/html/book/forms.htm...
if we replace TextareaTepe::class with null, then it works like that, but input text is inserted, and I need the same for textarea :
->add('caption', null,'required'=>false])

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-12-08
@prototype_denis

Not TextareaT e pe, but TextareaT y pe
api.symfony.com/2.6/Symfony/Component/Form/Extensi...
input text because the field is defined as a string in the entity. She will automatically substitute text, not textarea.
As for maxlenth.
symfony.com/doc/current/reference/forms/types/text...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question