Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • I asked because it seemed like a semantic problem, but I am using Doctrine 2 and from that standpoint I do not see how having database queries in a class that I would actually instantiate and send to the database makes sense, unless DBAL entities do not represent entities, in which case I don't think I have time to change the entire semantic basis of my project. With regard to the article I linked, do you disagree with what it is saying or do I just not understand MVC enough to see that your's and theirs' ideas run in parallel? Commented May 24, 2020 at 21:23
  • @ScottAnderson The article seems in line with what I said. I edited to add some quotes in relation with my statements. I have no expertise in PHP and Doctrine. But from what I understand, Doctrine is an ORM. It should play a key role in the Model implementation. I'm not sure it is intended to replace the model (e.g. there is no business logic. If the change in price would require to update other data, your ORM would not know, but the model should ensure such consistency). Commented May 24, 2020 at 22:05
  • I have read and re-read and I think I am getting the picture a lot better. If, by my misguided approach it did happen that: my Model was just a dumb ORM object, my Controller was a glorified gateway to the database, and my View was really just taking Model instances and crunching the data into HTML to inject, would that be tending towards a different pattern? Commented May 25, 2020 at 16:13
  • @ScottAnderson I think this explains rather well what happened and the initial confusion. It doesn’t lead to a fundamentally different pattern: database access (via ORM or not) is always in the model. Note however that the model does not need to be behind a monolithic facade Commented May 25, 2020 at 19:27