0

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

1 Answer 1

1

if u want to show same object after form send you must add to the form hidden field that stores object id ( probably if you are using database it has primary key already and u can get it by $entity->getId() )

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't think to that (but to send the entire entity, which was more hard) ! Thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.