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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:08:11+00:00 2026-05-10T21:08:11+00:00

I am using a very intrinsic database with a CakePHP application and so far

  • 0

I am using a very intrinsic database with a CakePHP application and so far my multi-models views and controllers are working fine. I have a singular table (Entity) that have it’s id on several other tables as the Foreign Key entity_id

Some tables are one to one relations (Like a Company is one Entity) and some are one to many (Entity can have several Addresses) and so on.

I won’t/can’t change the database model, so this is the structure.

I have been using saveAll() to save data on those tables with input names like:

Entity.type='x' (hidden inside the view) Company.name Address.0.street Address.0.city Address.1.street Address.1.city  ... and so on ... 

and my save all is doing all the hard job, BEGIN TRANSACTION, all INSERTs and a final COMMIT …

But now I’ve created a EntityCategory that is a n to n relation and created the full HABTM relation inside the model.

It works when I save() it but just the HABTM relation, and it saves everthing when I use saveAll() (just as before) except for the HABTM relation.

Am I missing something ? How I make this work correctly ? I am using the following code today:

if (!empty($this->data)) {   $this->Entity->saveAll($this->data);   $this->Entity->save($this->data); } 

The saveAll() saves all data in several tables, saves the id in Entity->id and the save() saves the HABTM relations, but I am not sure if it is correct or if it can bring me problems if I change some structure/model.

Is this the best way to use it? Is there a correct way to save that relations inside CakePHP ? What your experience/knowledge can tell me ?

  • 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. 2026-05-10T21:08:11+00:00Added an answer on May 10, 2026 at 9:08 pm

    This is fixed if you download the nightly.

    Be careful though, something else might break.

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

Sidebar

Ask A Question

Stats

  • Questions 167k
  • Answers 167k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Sorry to answer my own question but this was solved… May 12, 2026 at 1:26 pm
  • Editorial Team
    Editorial Team added an answer I think it's simply an omission by the BCL writers.… May 12, 2026 at 1:26 pm
  • Editorial Team
    Editorial Team added an answer I'd recommend taking a look at gettext in general and… May 12, 2026 at 1:26 pm

Related Questions

I am testing the speed of different methods to dynamically add html elements to
I am using a very component heavy form that takes long time to set
I am using a very stripped down version of Linux, I want to create
I am using a HttpListener to implement a very simple http server, which is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.