【问题标题】:Sonata one to many relationship奏鸣曲一对多关系
【发布时间】:2017-04-09 02:13:15
【问题描述】:

我是奏鸣曲的初学者,我不明白如何使用 2 个表 Oraganizations(one) 和 structures_type(many) 在一对多(下拉列表)中做 choicetype。
我在奏鸣曲文档中找不到任何东西。我使用奏鸣曲 2.3 和 symfony 2.8。
如果有人可以帮助我解决这个问题。这是代码:

protected function configureFormFields(FormMapper $formMapper)
{
   $formMapper
           ->add('structurestypes', EntityType::class, array(
               'class' => 'HandissimoBundle:StucturesTypes',
               'choice_label' => 'structurestype',
               'label' => 'Type de structure',
               'expanded' => true,
               'multiple' => true,
               'by_reference' => true
           ));
}

【问题讨论】:

标签: symfony relationship one-to-many sonata-admin sonata


【解决方案1】:

如果您只是将 'expanded' 属性设置为 false 或将其删除,则会出现一个下拉列表,因为默认值为 false。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-01
    • 2014-11-29
    • 2015-09-06
    • 2014-04-01
    • 2018-04-19
    • 1970-01-01
    • 2018-11-08
    • 2019-05-17
    相关资源
    最近更新 更多