I am learning MVC framework(CI & YII for now)
Towards this i am trying to port an existing application which was done the functional way to MVC framework (say for example to CI)
Here's what I have thought about it:
1) For every database table I will create a fresh model class
2) then take up each php page like login.php, register.php, member.php etc and break it into two components for the view & controller.
Anything else that is important to keep in mind ?
Actually i have a gut feeling that there's more to the controller design than this.
How to decide the number of controllers required?
Porting functional code to MVC structure
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Porting functional code to MVC structure
A Model is not always just a Gateway to a database table. A Model is an Entity in the Domain of the problem that the web application solves.Live24x7 wrote:1) For every database table I will create a fresh model class
A Controller deals with one or more associated request, and controls the program flow for those requests. So you could have login and register Controllers, or you could have a user Controller with login and register actions. It often makes sense to group related requests.Live24x7 wrote:2) then take up each php page like login.php, register.php, member.php etc and break it into two components for the view & controller.
Anything else that is important to keep in mind ?
Actually i have a gut feeling that there's more to the controller design than this.
How to decide the number of controllers required?
(#10850)
Re: Porting functional code to MVC structure
Thanks will keep that in mind as the acid test for every model design.Christopher wrote:A Model is not always just a Gateway to a database table. A Model is an Entity in the Domain of the problem that the web application solves.
That is great..definitely helpfulIt often makes sense to group related requests.