2
からダイナミックなフォームフィールドは、私がフィールドで、データベース内のテーブルを持っている: - FIELD_LABEL、field_type、field_caseなどsymfonyの3データベース
私はdinamically field_caseでフォームにフィールドを追加したい。 exeampleについては
:このフォームタイプで 私はfield_case = 1
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add("companie_uid", HiddenType::class);
$builder->add("companie_denumire", TextType::class, array('label' => 'companie_denumire'));
$builder->add("companie_cui", TextType::class, array('label' => 'companie_cui', 'required' => false));
$builder->add("companie_j", TextType::class, array('label' => 'companie_j', 'required' => false));
$builder->add("companie_mail", EmailType::class, array('label' => 'companie_mail', 'required' => false));
$builder->add("companie_website", TextType::class, array('label' => 'companie_website', 'required' => false));
$builder->add("companie_status", HiddenType::class);
$builder->add("companie_descriere", TextAreaType::class, array('label' => 'companie_descriere', 'required' => false));
$builder->add("companie_telefon", TextType::class, array('label' => 'companie_telefon', 'required' => false));
$builder->add("companie_iban", TextType::class, array('label' => 'companie_iban', 'required' => false));
$builder->add("companie_banca", TextType::class, array('label' => 'companie_banca', 'required' => false));
$builder->add("file", FileType::class, array('label' => 'companie_file', 'mapped' => false, 'required' => false));
$builder->add("save", SubmitType::class, array('label' => 'companie_save'));
$builder->add(
$builder->create('address', CompanyAddressType::class, Array('by_reference' => false,))
);
}
と、データベースからすべてのフィールドを追加したいと私はテーブルからフィールド field_case = 1
$builder->add(field_id, field_type, array('label' => 'field_label'));
を追加します
他のテーブルのデータベースに保存してくださいfield_values
を使用することができますか?私はドキュメンテーションから理解できませんでした。 – Senzo
私はあなたのbuildForm関数で書いたコードを置くだけです... – Alsatian