RE: [PHP] What is the best practice for adding persistence to an MVC model?

2009-10-27 Thread Mert Oztekin
Hi Eric, IMO, controllers shouldnt be responsible for interacting models and datastoreres. Controllers might only change the datastore class of a model. You may use your models in lots of controller functions. Defining datastore in all controllers seems not a good practice. (too much

RE: [PHP] What is the best practice for adding persistence to an MVC model?

2009-10-27 Thread David Murphy
I take a different approach : // In the MainHandler Define('StorageClassName',_MySQL); Class UserController { function __construct($objDataStore=false){ if(!$objDataStore) $this-DataStore = new instanceof($this).STORAGECLASSNAME ; }

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

2009-10-27 Thread Paul M Foster
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

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

2009-10-27 Thread David Otton
2009/10/27 Paul M Foster pa...@quillandmouse.com: 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

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

2009-10-27 Thread Paul M Foster
On Tue, Oct 27, 2009 at 04:11:32PM +, David Otton wrote: 2009/10/27 Paul M Foster pa...@quillandmouse.com: 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

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

2009-10-27 Thread David Otton
2009/10/27 David Otton phpm...@jawbone.freeserve.co.uk: If you go with the first approach, you're writing code that you and anyone who comes after you can write useful tests for. The others, and you're denying maintenance programmers a useful tool. I should have lead with this: the wikipedia