Welcome Guest, Not a member yet? Register   Sign In
MVC, MySQL Transactions, and referencing a model from within a model
#11

[eluser]mddd[/eluser]
It should not be very heavy because the objects are copied by reference. Not the actual objects are copied but only the "links" to those objects!
#12

[eluser]icomefromthenet[/eluser]
I still consider the Models to be examples of Table Data Gateway, I keep the business logic out of the models and keep them in my transactional scripts (controllers) most of the time. When appears that functionality is duplicated I make a library or factor out into a base controller. (MY_Controller often has 5 or 6 classes in it as base for different modules of my site).

When comes to joins pain can occur, I often use views instead of joins and have a select only model. Using controllers as transactional scripts give you theoretical lee way.

Patterns like Unit of Work, can help to manage your transactions but keeping and identity map to track state is an overhead which hard to justify in the smaller projects.




Theme © iAndrew 2016 - Forum software by © MyBB