I'm re-writing a small app with Phalcon in which I collect information about the user. Essentially, I grab firstname, lastname, email, whether or not the person is married, some numbers pertaining to that person, etc across multiple pages. When the user "finally" submits their information (after being asked to review it), I write some information to the DB and perform a number of calculations to generate a report, which gets emailed out.

Prior to the rewrite information was stored in session directly, ie

 "$firstname = $this->session.get('firstname', '');". 

I'm uncomfortable with this approach, as sessions are being used essentially as user objects. What I would like to do is generate a session id, and write that information to a database each time, and then retrieve it accordingly. However, we don't get that much information from the user, and we've noticed that people tend to start the report process and then bail out or go elsewhere. In this case, I don't know whether or not it makes sense to write to the DB each time for the sake of collecting information and flushing it at the end.

I guess what my question boils down to is what would be the ideal approach, seeing that I don't think I need to hit the DB that much. The practice of storing user information in the session could continue, or I could generate User objects and store them in the session or a cache respectively. Any thoughts on this would be much appreciated.

Related posts

Recent Viewed