EllisLab text mark
Advanced Search
     
working with multiple models/classes
Posted: 05 September 2007 03:15 PM   [ Ignore ]
Avatar
Joined: 2007-08-03
62 posts

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!

 Signature 

PHP Site Solutions | Nested Set library for CI

 
Posted: 05 September 2007 03:39 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-08-03
62 posts

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.

 Signature 

PHP Site Solutions | Nested Set library for CI