Welcome Guest, Not a member yet? Register   Sign In
dependencies between models, without using any ORM or DataMapper systems
#1

[eluser]Unknown[/eluser]
Hello everyone.
I'm writing a CRUD system using CodeIgniter, implementing some 'one to many' dependencies between models (without using any ORM or DataMapper systems) by calling methods from one model to another.

For example: in a "many Documents per User" dependency, when deleting a User, the User_Model directly calls the delete() method on the Document_Model, deleting any documents associated with it.

I’m certain there’s a better way implementing 'one to many' model relationship (without ORM, etc.. ), and would appriciate some guidance.

Thanks Alon.
#2

[eluser]johnpeace[/eluser]
I would probably do it this way first:

"This first (knowing it isn’t elegant) is calling methods from one model to another,
for example: on a “many Documents per User” dependency, when deleting a User, the User_Model will directly call the delete method on the Document_Model, deleting any associated documents to it."

It's just simpler, easier to read and more straightforward this way.




Theme © iAndrew 2016 - Forum software by © MyBB