Timeline for In a MVC application, should the controller or the model handle data access?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 12, 2020 at 16:33 | comment | added | Minh Nghĩa | Many guides on MVC claim that user input must be inside controller though... | |
Mar 21, 2020 at 16:59 | comment | added | Jeaf Gilbert |
In PHP, a model cannot do $stmt->fetch(PDO::FETCH_CLASS, $this) . I can cast all the properties manually by $this->id = $object->id , but it could be really long and not easy to maintain (if there are any column changes). Does it mean PHP wants us to do the queries in Controllers? Or is there any proper code to replace: $stmt->fetch(PDO::FETCH_CLASS, $this) ?
|
|
Jul 18, 2018 at 8:28 | comment | added | Ken | Wow sure would be nice to have a small project example of your write up .. I think that would clarify things for me greatly. Even if it was simply name and address sample .. | |
Dec 19, 2016 at 1:42 | comment | added | user2849202 | "Model - business logic, interface to data store" and "The Model should never format data. It also should not read formatted data." So what happens when you have json data that you need to add to a database? Obviously the Model in your logic should not accept is as such, json. So it should be reowrked. By whom? By an interface into the Model. But you just stated that the interface is .... the "Model ... (is) interface to data store". There is at least a seeming contradiction there that needs to be resolved or clarified. | |
Nov 10, 2015 at 20:15 | history | edited | BryanH | CC BY-SA 3.0 |
fixed spelling error and expanded model info a bit
|
Jul 23, 2014 at 23:43 | history | edited | Blorgbeard | CC BY-SA 3.0 |
typo
|
Oct 2, 2012 at 16:44 | comment | added | Scottie | Thanks for all the great comments. Hard to choose a single "correct" answer, as they are all correct, but Bryan seems the most complete. | |
Oct 2, 2012 at 16:44 | vote | accept | Scottie | ||
Oct 2, 2012 at 16:23 | history | edited | BryanH | CC BY-SA 3.0 |
json/model
|
Oct 2, 2012 at 16:16 | history | edited | BryanH | CC BY-SA 3.0 |
expanded reasons
|
Oct 2, 2012 at 16:10 | history | answered | BryanH | CC BY-SA 3.0 |