I'm new to Symfony. I have an action that takes from the database a random object A and display it with Twig. It also shows a form. When the form is submit, it is "relaunching" the action and show another random object A.
How can I do to save my object A (which is a entity)? I thought about a global variable but I've read this is not very good)
I think it's all about the "symfony" logic that I don't have yet :)
PS : I'm french, sorry if my english is a bit bad :)
Thank you in advance,
Julien
如果您想在表单发送后显示同一对象,则必须添加到存储对象ID的表单隐藏字段中(可能如果您正在使用数据库,它已经具有主键,并且您可以通过$ entity-> getId()来获取它)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.