Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6910759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:51:21+00:00 2026-05-27T08:51:21+00:00

With traditional OOP, I would (or could, rather) create a model / object that

  • 0

With traditional OOP, I would (or could, rather) create a model / object that represents a User, with properties that reflect that, i.e., name, id, job title, etc.

I could then create a new instance of that object and assign it to a variable, and if I was looping through a result set, I could create an instance for each one. With CodeIgniter, this seems impossible, as doing:

$this->load->model('User');

Instantiates it, and places it for use at $this->user.

Isn’t there any way to use models as objects in a more traditional manner? But without hacking the CodeIgniter way of doing things?

I understand that you can assign things to a different object name using $this->load->model('User', 'fubar'), but it’s not as dynamic as simply assigning an instance to a variable.


Thanks for the answers guys. I think that I missed a vital part of working the "CodeIgniter Way", but I’ve just been looking through a contributed library, and the practice of using the same instance (assigned to the CodeIgniter namespace), but clearing the instance variables after each use, seems to be a great way to work that removes my reservations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:51:21+00:00Added an answer on May 27, 2026 at 8:51 am

    You don’t have to use the load() functions. You can just use require_once and new User(), like you normally would.

    Using the load() should only be for things you want in the global CodeIgniter namespace. As you can see, it gets polluted really quickly if you try to use it for everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My teams evolution of TDD includes what appear to be departures from traditional oop.
Say I got an traditional SQL structure like so: create table tags (id PRIMARY
Few of my friend said that traditional way of programming can conflict. For an
A traditional Make process that I cannot modify produces a target on which I
I'm just wondering. What makes OOP significantly better than traditional structured programs. I understand
I have a setup with a traditional form that's checked with jQuery Tools validator
Could someone show me an traditional example of a calculation e.g. find average of
Traditional version control systems follow a Cathedral model -- all the code is stored
The traditional approach to manage access to controller actions is to create resource (string
I have a traditional RDBMS based PHP app that I need to convert over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.