I think the easiest way to ask this question is the real real situation that I am facing.
In our system, we have a site model (the classic MVC structure here), which represents a row in our site table. One of the fields in the site table that is stored in the site model is the time zone of the site. We use this to adjust the UTC time from the database to the site’s displayed time zone. There are several helper methods that help with this: utcDatetimeToSiteTimestamp (), utcTimeStampToSiteDatetime (), etc.
Since these helper methods use the time zone of the site, which is stored in the site model, can these methods be included in the model? Or should they be placed in a separate helper class or something else?
I know that models should do more than just hold a row of data from a database, but where is the line between helper methods that act on this data versus helper methods that use this data to work on an external input?
Thank you for understanding!
source
share