خرید بک لینک

Vote count: 0

I'm aware that in MVC, the Model is the class part.

If I have a User class and instantiate an object, the object must refer to a single user from the database.

So I'll have the CRUD methods on the user, for that specific user.

But if I need a function to run a SELECT * FROM Users, should I create a function within the User class? Or a function in a helper file? Or in the controller? Where should it go, in order to respect the MVC patte?

I mean, it makes no sense to instantiate a User object just to run a function to display the Users table.


I'm not sure if this will raise "primarily opinion based" flags. I just don't know where those functions should go. If you guys consider the question worth closing, it's ok. But tell me in the Idea in which stack community I should ask this.

asked 10 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 22 خرداد 1395 ساعت: 1:36

صفحه بندی