S
S
Sergei Iamskoi2015-01-28 10:28:50
Design patterns
Sergei Iamskoi, 2015-01-28 10:28:50

MVC - where should the logic be?

I understand with MVC on PHP. I still can’t decide where to write the logic: in the controller or in the model. Opinions on the Internet also differ greatly, someone says that the conditions should be written in the controller, someone in the model. Those. there are fat models and thin controllers and vice versa - thin models and thick controllers. And I wonder what influenced your choice?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Filatov, 2015-01-28
@NYMEZIDE

The logic of working with a database or other data source - write in the Model
Logic for processing requests from the user (GET, POST, ...) -
everything is logical in the Controller, isn't it?

A
Alexander, 2015-01-28
@Aleserche

Personally, I displayed the logic in a separate layer, if there was a lot of it. Then it was convenient to accompany all this stuff.

E
Eugene, 2015-01-28
@Nc_Soft

Definitely not on the controller, it is not to be used again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question