gpt4 book ai didi

php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities

转载 作者:可可西里 更新时间:2023-10-31 22:53:49 25 4
gpt4 key购买 nike

我正在尝试使用 PageHasImage 桥接实体在 PageImage 实体之间实现多对多关系。在 PageAdmin 中,我添加了如下字段:

->add(
'galleryImages',
'sonata_type_collection',
array(
'cascade_validation' => false,
'by_reference' => false,
'type_options' => array('delete' => false)
),
array(
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
'admin_code' => 'sonata.admin.page_has_image'
)
)

这让我可以选择添加新的 Image 字段,然后上传新图像或从已上传图像列表中选择它。上传部分按预期工作,但从已上传的图像列表中选择没有任何作用。 Images 列表中的Select 按钮在其 href 中只有“#”,似乎没有做任何有用的事情。列出的图像旁边也有复选框,但没有操作按钮来使用选择。

我应该如何配置才能使列表中的操作有意义?我的猜测是关系的设置者或生命周期事件方法中缺少一些东西,但我希望得到一些指导。

最佳答案

好吧,我可以看出这不是一个流行的问题,但对于任何很快遇到这个问题的可怜人来说——奏鸣曲中有一个错误。此外,我将 Sonata Admin 文档评为 4/10 ... 我花了几天时间寻找对奏鸣曲形式的各种配置参数的体面描述,确保我配置错误。度过一生的好方法,嗯。

这是解决方案:https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/404

为了完整起见,我将其复制在这里:

在 Resources/views/CRUD/edit_orm_many_association_script.html.twig 中注释以下行可以解决问题

if (this.nodeName == 'A' && (target.attr('href').length == 0 ||     target.attr('href')[0] == '#')) {
Admin.log('[{{ id }}|field_dialog_form_list_link] element is an anchor, skipping action', this);
return;

关于php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29277488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com