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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:18:06+00:00 2026-05-15T04:18:06+00:00

Based on cakePHP’s data model conventions, to setup a foreign key I would specify

  • 0

Based on cakePHP’s data model conventions, to setup a foreign key I would specify a column with the source_table followed by an _id.

I have an accounts and an account_messages table. Now the complication arises when I need 2 foreign key references to the same accounts table. Specifically I need to keep track of the account_id in the TO field and the account_id in the FROM field on a message.

From the docs/bakery, I would specify account_id.. however what would I specify for the second reference?!?

Is this possible and still benefit from cakePHP’s magic code?

Any insight would be appreciated.

Ry

  • 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-15T04:18:07+00:00Added an answer on May 15, 2026 at 4:18 am

    I usually will do something like having a to_id and a from_id and then use something like this

    I think all that you need is in that link

    HTH
    Sam

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

Sidebar

Related Questions

I followed this tutorial to create multilingual site. http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ However although I can get
Using CakePHP's Ajax based observefield, I would like to update multiple fields, into my
I have a cakePhp application built, and now I'm creating a simple blog based
On my cakephp based site, when i do multiple requests simultaneously, cakephp logs me
I'm building a controller to manage group based ACL in CakePHP and when I
I have a single model in CakePHP that has multiple forms on different pages
Greetings! I have CakePHP based app on shared hosting I wonder if there's a
Anybody knows how to execute this using the famous Cakephp ORM-based 'find' query function?
We've been using for long time web development frameworks based on PHP libraries (CakePHP,
I am putting together a multilingual site according to the tutorial: http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ However, the

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.