Thoughts on data persist in Symfony 2

Hi All,

Today I will be discussing about persisting form submitted data in Symfony 2. Data persisting is all about inserting/updating records to/in a table in database. In this example I assume that you have a form ready which will contain few fields in order to insert values to the database. This is exactly what I am going to do in the following scenario. I will have a table (Entity) called ‘user_details (UserDetails)’. I will be passing some values from a form (which is not here) to the ‘insertUserDetails‘ action in ‘UserDetails‘ controller. Then using that action, I will be inserting new user details to the ‘user_details‘ table.

Well, in this post I would like to have an open ended discussion regarding data persisting. The approach you are using can be different from mine but still do the same intended job. More or less performance can vary, lines of codes can vary, efficiency can vary and so on.  You can see the controller and function below. First take a look at the code and I will explain the code below. Continue reading

Share