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

  • Home
  • SEARCH
  • 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 853813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:49:20+00:00 2026-05-15T07:49:20+00:00

I’m moving towards an ORM for my codeigniter application and have chosen datamapper .

  • 0

I’m moving towards an ORM for my codeigniter application and have chosen datamapper. However, in the rules section, it states the following:

A joining table must exist between
each related normal tables, regardless
of the type of relationship.

I have dozens of tables that are in a one->many relationship. Does this mean that I have to create intermediate (joining) tables between each of them as if they were many-many?

  • 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-15T07:49:21+00:00Added an answer on May 15, 2026 at 7:49 am

    No, actually, the model that has a $has_one relationship set will have a field ending in _id, which refers to the object with the $has_many relationship set.

    So, for example:

    class Recipe extends DataMapper {
        var $has_many = array('product', 'rating', 'recipe_category');
        var $has_one = array('recipe_source', 'user');
        (...)
    }
    
    class Recipe_Source extends DataMapper {
        var $has_many = array('recipe');
        (...)
    }
    

    In this case, DataMapper made a table recipes with a recipe_source_id column, and a recipe_sources table that required no extra fields.

    Now, for many-to-many relationships, a join table will be created, and it follows a strict convention.

    The join table name will be the two plurals of the joined models, separated by an underscore, in alphabetical order.

    So, using this model:

    class Product extends DataMapper {
        var $has_one = array('cheese_style', 'butter_style', 'cheese_flavor');
        var $has_many = array('product_size', 'recipe');
        (...)
    }
    

    Now, I end up with a join table in my database called products_recipes.

    This is how it is handled by the DMZ DataMapper library (http://www.overzealous.com/dmz/), which is supposed to be a drop-in replacement for the old stensi DataMapper library, so I’m going to assume the conventions are the same.

    Even so, I highly recommend making the switch to DMZ.

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

Sidebar

Related Questions

No related questions found

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.