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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:21:15+00:00 2026-05-28T06:21:15+00:00

Working on an old Kohana 2 project and I want to link two models.

  • 0

Working on an old Kohana 2 project and I want to link two models.

I have a model called User with the following ORM relationships:

protected $primary_key = 'User_ID';
protected $belongs_to = array('group');
protected $has_many = array('user_address');

I have another Model called User_Address with ORM relationships:

protected $table_name = 'user_address';
protected $belongs_to = array('user');

However I am getting the following SQL error:

Unknown column 'user_address.user_User_ID' in 'where clause' - SELECT `user_address`.* FROM (`user_address`) WHERE `user_address`.`user_User_ID` = 2 ORDER BY `user_address`.`id` ASC

I can see from the error that it is trying to link to user_address.user_User_ID whereas it should be user_address.User_ID. Is there a way to map the foreign key like Kohana 3?

  • 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-28T06:21:16+00:00Added an answer on May 28, 2026 at 6:21 am

    Got it!

    Needed to add protected $foreign_key = array('user_address' => 'User_ID'); to the User_Model

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

Sidebar

Related Questions

I am working on old sites and updating the deprecated php functions. I have
I'm working on an old project written and then patched by several people over
I am working on an old database, that i do not want to touch
im working on a old code and i have this warning message: Passed-by-value struct
I am working on an old MFC project. Users are using Windows 7 they
While working with old app using rails 2.0.2 with ruby 1.8.6, getting following problem...
I am working on an old VB6 app and have recently added the Siemens
I'm working with some old PHP code that has a lot of the following:
I have just been re-working an old bit of compiler-like code written using bison.
Working on an old site in asp classic. I want to write a function

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.