parrare un parametro nelle $options in un $form

28 views
Skip to first unread message

Oda

unread,
Jan 21, 2019, 5:23:46 PM1/21/19
to symfony-it
Ciao a tutti!
vorrei passare un "optiion"  nel buildForm (per aggiungere o meno un campo)

class TaskType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
      if($options['inseriscCampo'])... ->add..
[...]

ma restituisce un errore.
Come se i valori di $option andassero dichiarati prima.... ma dove?!
Grazie in anticipo.
Oda



Massimiliano Arione

unread,
Jan 22, 2019, 7:34:22 AM1/22/19
to symfony-it

ATTENZIONE! QUESTO GRUPPO NON È PIÙ ATTIVO

Si consiglia di usare invece il canale #symfony dello Slack del GrUSP (link per iscrizione)

ciao

Luca saba

unread,
Jan 22, 2019, 8:58:17 AM1/22/19
to symfo...@googlegroups.com
Non sapevo del canale slack! Grazie Massi!

Invece, per la domanda, penso sia questo quello che ti serve: https://symfony.com/doc/current/components/options_resolver.html#required-options

L.

--
Hai ricevuto questo messaggio perché sei iscritto al gruppo "symfony-it" di Google Gruppi.
Visita questo gruppo all'indirizzo https://groups.google.com/group/symfony-it.


--
It is easier to move a problem around (for example, by moving the problem to a different part of the overall network architecture) than it is to solve it.
6th truth - rfc1925
------------------------------------------------------------------
Einstein: Imagination is more important than knowledge. For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution.
------------------------------------------------------------------
Heinlein: Specialization is for Insects
Reply all
Reply to author
Forward
0 new messages