同时编辑多个实体 [英] Editing multiple entities simultaneously

查看:54
本文介绍了同时编辑多个实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在一个实体中编辑数据,但是我需要使用单个提交按钮在单个页面上编辑更多实体.最好的选择是什么?具体来说:我列出了购物车",我想同时编辑每一行(购物车实体)的数量"字段

I know how to edit data in one entity, but I need to edit more entities on single page, with single submit button. What is the best option to do it? For being more specific: I've got a Shopping Cart listed, and I want to edit "quantity" fields for each row (cart entity) simultaneously

我知道我必须以某种方式生成表单,并且如果每行都具有更新"按钮,我也知道该怎么做,但是它必须类似于给定的屏幕截图.

I know that I have to generate form somehow, and I understand how to do it if I would have "Update" button for every single row, but It must look like on the screenshot given.

.

推荐答案

您正在寻找的是Symfony的

What you are looking for is Symfony's Form Collections. The Form Collection allows you to add and/or edit multiple entities at once. Have a look at the Tags examle in the documentation which shows how you can add/update/delete tags. You will need to do pretty much the same thing for your shopping cart.

这篇关于同时编辑多个实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆