Sonata Admin Bundle:如何在表单中向嵌套实体列表中的实体添加 "Delete" 按钮?

Sonata Admin Bundle: How to add a "Delete" button in form, to the entities on the nested entities list?

在父实体中我可以做类似的事情:

protected function configureFormFields(FormMapper $formMapper)
{

    $formMapper->add('units', 'sonata_type_collection', [
        'required' => true,
        'by_reference' => false,
        'label' => 'Units',
        'type_options' => [
            'delete' => true,
        ],
        'btn_add' => 'Add unit',
    ], [
        'edit' => 'inline',
        'inline' => 'table',
        'sortable' => 'position',
        'multiple' => true,
    ]);
}

这将显示一个删除复选框。在每个 unit 旁边设置一个简单的 "Delete" 按钮以允许将其从列表中删除的正确方法是什么?有没有可能用最少的配置有这样的东西?

我想用最少的配置是不可能的。您应该覆盖模板或制作自己的模板