Welcome Guest, Not a member yet? Register   Sign In
Loading a model in a model - is bad?
#4

[eluser]DanSearle[/eluser]
well yeah, I know that much.

My situation is that when a Create action happens on my user table, it also causes a Create action on a second table, and it also generates an email. Since these actions always happen on Create - I thought the smart place to put all this code would be in one model - but I see that's breaking the MVC pattern so I'm looking for alternatives.
I don't want to put all the code into the controller, because there will be more than one controller making these Create actions, and I don't want to duplicate this code.

So I think now the best place to put it all is in a Library class - this lib can have a public "create" method - my controllers call that, and this create method does all the updating to models and email sending.

I'm new to this and I'm just trying to go about things the way CodeIgniter intended me to, rather than hack in a solution.


Messages In This Thread
Loading a model in a model - is bad? - by El Forum - 10-13-2010, 12:48 PM
Loading a model in a model - is bad? - by El Forum - 10-13-2010, 02:06 PM
Loading a model in a model - is bad? - by El Forum - 10-13-2010, 11:50 PM
Loading a model in a model - is bad? - by El Forum - 10-14-2010, 02:04 AM
Loading a model in a model - is bad? - by El Forum - 10-14-2010, 02:36 AM
Loading a model in a model - is bad? - by El Forum - 10-14-2010, 02:39 AM
Loading a model in a model - is bad? - by El Forum - 10-14-2010, 03:59 AM
Loading a model in a model - is bad? - by El Forum - 10-15-2010, 04:07 PM
Loading a model in a model - is bad? - by El Forum - 10-16-2010, 12:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB