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 7954117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:19:34+00:00 2026-06-04T03:19:34+00:00

I am using CI, however this question applies to models and db persistence in

  • 0

I am using CI, however this question applies to models and db persistence in general. I find myself creating methods in models like:-

private function create_joins() {
  # Add some joins to the global db object using the active record 
}

I do this so I can then perform common joins for a particular model without duplicating the code for creating the joins.

So a select method might be:-

public function get_by_id($id) {

    $this->db->select('some_cols');
    $this->db->from('some_table');
    $this->create_joins();
    $this->db->where(array('id' => $id));
    etc...
}

Which is fine, but I am wondering if this is the sort of thing that an ORM like datamapper can abstract away?

  • 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-06-04T03:19:36+00:00Added an answer on June 4, 2026 at 3:19 am

    You should try Doctrine, which is one of the most advanced ORM in PHP:

    Using Doctrine, you won’t even have to write methods such as get_by_id($id) in your model : they are handled by Doctrine itself.
    So you would be able to write:

    $entityManager->find("Bug", $id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the code as described in this question. However get following error
I have basically the same problem outlined in this question, however I am using
I am using django-threadedcomments , however the question also applies generally to sorting a
I'm using @diegoperini's regex to validate URL's, However this: http://domain.com/#foo -> Matches http://domain.com#foo ->
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I'm using a detailsview control to update a record, however in this particular case
I deployed an application using this method and it worked very good. However, there
I understand that this can be done at release using the maven-gpg-plugin. However, I
I am currently using this DOCTYPE: <!DOCTYPE HTML SYSTEM> However, when I validate my
I am making a test fullscreen application using this guide . However, I am

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.