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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:40:42+00:00 2026-05-24T07:40:42+00:00

I have 2 tables: release_servers and release_components I have a link table release_server_to_components I

  • 0

I have 2 tables: release_servers and release_components
I have a link table release_server_to_components

I right now have it so that each server can have multiple components and that each component can be on multiple servers.

The following are the create statements:

CREATE TABLE `release_components` (
  `id` int(11) NOT NULL auto_increment,
  `buildID` varchar(45) default NULL,
  `svnNumber` varchar(45) NOT NULL,
  `componentType` varchar(45) NOT NULL,
  `release_id` varchar(45) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM 

CREATE TABLE `release_servers` (
  `id` int(11) NOT NULL auto_increment,
  `server_name` varchar(45) NOT NULL,
  `server_environment` varchar(45) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM

Link table:

CREATE TABLE `release_server_to_components` (
  `id` int(11) NOT NULL auto_increment,
  `release_component_id` int(11) NOT NULL,
  `release_server_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM 

What I want to add is the ability to have a system ID — this system ID would be per component on a server (not per server and not per component, but per the component on each server). I want to be able to easily add the system ID per component and insert it into the database.

I can provide code for models and controllers if needed.

  • 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-24T07:40:44+00:00Added an answer on May 24, 2026 at 7:40 am

    You want to “fake” Ruby’s through association with CakePHP.

    Why do this over HABTM?

    Because you want to save data about the association. With Cake’s HABTM saving data about the association is difficult, because the only thing you really have is a JOIN table. You need something more powerful than this.

    First, get rid of the $hasAndBelongsToMany property in your model. Next we’ll be refitting your release_server_to_components table as your “through” table.

    So, in ReleaseComponent and ReleaseServer model you would have an association like this:

    $hasMany = array('ReleaseServerToComponent');
    

    Now, in your new ReleaseServerToComponent model you would have an association like this:

    $belongsTo = array('ReleaseComponent', 'ReleaseServer');
    

    Now, you can access this table just like a normal Cake model, ie $this->ReleaseServer->ReleaseServerToComponent->find(). You can add additional fields to the through table, like server_component_name. You already have a unique identifier for specific, server components with the primary key of the release_server_to_components table.

    You could save this data using Cake’s saveAll() method. Alternatively you could generate your own data to save, simply plugging in the server ID and component ID from form fields. At the top of that link is the format saved data should be in when you pass it to the model’s save method.

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

Sidebar

Related Questions

In my database I have tables that define types for example Table: Publication Types
I have two tables that look like following: RELEASE TABLE name asin MATCHES TABLE
When I have tables in my database that have PK/FK relationships (int) and when
I have 3 tables Links Link ID Link Name GroupID (FK into Groups) SubGroupID
I have two tables that are joined together. A has many B Normally you
I am working on a project where I have a table view that is
I have a DataSnap server that creates a TSQLQuery, TDataSetProvider and a TClientDataSet that
I have a table that stores formulary drug information and needs to be updated
Say we have some poorly written SQL that does not release temp tables when
I have server service which releases the table database if a certain criterian is

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.