Weird behavior in CodeIginiter

So, in the website I’m making for my dad, I’m using CodeIgniter as the application framework. It’s pretty nice in taking care of the stupid stuff I’d rather not think about, and extending the framework is super simple when you’ve got a reason to do so.

Recently, however I’ve come across something that’s weird. In one of my controllers, I’m load two different models in the constructor. Both models are extended from a custom Model class that extends the core CI_Model class. One represents a user, and the other represents a sale listing. Nothing too fancy done. In the custom parent Model class I wrote, I wrote a constructor function which sets the default table to look at. This works fine for the User model, but not for the Sales model. Not sure if it has something to do with my code or if it’s a result of a bug with CodeIgniter so I’m going to set up a small test case later.

Update: So I was wrong. I was extending the wrong class in the sales Model. Something else did come about while I was looking into this. For some reason. When Loading two models manually and right after each other, the first loses its table details. Don’t know why, as they should be two separate objects, but it’s easily handled by doing the work with first model, and then doing the work with the second.

Advertisements

About imaginationac

I make things with computers.
This entry was posted in codeigniter, programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s