Welcome Guest, Not a member yet? Register   Sign In
working with multiple models/classes
#1

[eluser]Jon L[/eluser]
hey all, I have a question regarding models/libraries.

I'm working on developing a Forum, while hoping to reuse models that I create for other purposes, such as Blogs.

I'm using a modified version of the Nested Sets model that was posted in the forums by Thunder. the class extended Model, so when I developed a "Categories" model and a "Posts" model, they each extended the Nested Sets model.

I'm changing the implementation now, so that the Nested Sets class is included as a library instead of a model. Nested set now does not extend anything, it's just an established class that uses the $CI instance (get_instance)
To customize how categories/posts are returned, I'm developing a "Forums" model that will interface with both the "Categories" and "Posts" models

My dilemma is this. Due to my code changes:
Categories_model extends Model (and uses $this->load->library to load the nested set class)
Posts_model extends Model (and uses $this->load->library to load the nested set class)
Forums_model extends Model (and uses $this->load->model twice, to load both Categories and Posts)

Will I have any conflicts with loading the nested set library twice?
Additionally, is there a better way to implement this? I do feel nested set should definitely be a library, so I think I'm right there, but then how I'm implementing Forums_model to use Posts_model and Categories_model seems it might post some problems, so I figured I'd post here before going further

Can anyone provide me any assistance on this issue?

Many thanks!
#2

[eluser]Jon L[/eluser]
it appears there's no native way to instantiate multiple occurrences of a library (the same way I can instantiate multiple occurrences of a model)... that blows.




Theme © iAndrew 2016 - Forum software by © MyBB