• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MVC structural advice - separation of code

#21
[eluser]Lyon[/eluser]
[quote author="WanWizard" date="1279846228"]If you have defined these three models, and the relationship between them, DMZ will check the relationship, and will do an update if it exists, or an insert if it doesn't.

If you would create a new object for catagories_posts, and would do a $catagories_posts->save() without having it linked to a catagory and a post, I'm not sure it would complain that it is missing some relationships. I'd have to try that.

EDIT: just tested it. It doesn't. It will create a junction record with foreign key values 0.[/quote]

Oh ok, thanks for the info. Smile
I am in the process of setting up DMZ at the moment.
It seems to be going okay, but only the next few hours will tell lol.

#22
[eluser]oldblueday[/eluser]
[quote author="Burak Guzel" date="1276650473"]I would make every form submit to a separate controller method. You can just set the different destinations in your form_open() calls.

That way you don't have a single function handling all kinds of different form submissions.[/quote]

One big controller vs Many small controllers - which is better?

Sorry to resurrect this old thread, but I had a question on this point. So it sounds like Lyon had one page with several forms which initially returned to the same controller for processing. Burak, you suggest that each form would go to a different controller method. Is that one controller with many methods or many controllers?

I guess what I'm asking is: should controllers be big and encompass many function that have similar goals (ie, processing similar info, doing similar tasks) or is it better to break that behemoth controller into many smaller ones? (I think I just answered my own question, but I'd like to know what the consensus opinion is - thanks!).



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.