Re: What is the best practice for adding persistence to an MVC model?

From: Date: Tue, 27 Oct 2009 15:30:11 +0000
Subject: Re: What is the best practice for adding persistence to an MVC model?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-299383@lists.php.net to get a copy of this message
On Tue, Oct 27, 2009 at 05:27:07PM +1100, Eric Bauman wrote: > I'm in the process of implementing an ultra-light MVC framework in PHP. > It seems to be a common opinion that the loading of data from a > database, file etc. should be independent of the Model, and I agree. > What I'm unsure of is the best way to link this "data layer" into MVC. I disagree. There should be database class(es) which know how to deal with the datastore(s). This may be as simple as a thin layer over the PDO classes. The model talks to and uses the database class, and is the only component which deals with the database class. The model serves up whatever data the controller needs to feed to the view. All are welcome to disagree. Paul -- Paul M. Foster

« previous php.general (#299383) next »