Associated records fail to update

And so the 3.x frustration train races forward.

I have code that successfully saves associated records to the main entity if they do not exist in the form submitted. In other words, if I prepare the associated entities manually in the controller, they can be submitted.

But if my associated entity lives in the submitted form, nothing I do saves them and I get no errors from cake. A debug of the data prior to saving shows no validation errors and shows all data correct. But it does not save. A view of the SQL log shows no attempt is even made to save.

So what do I have to do?

I have to manually iterate through every single associated entity in my submitted form and then manually create entities for saving by querying them individually from the database (when they exist) and then saving them using their own entity->save()… or creating new entities when they don’t exist and then manually saving each.

Let’s assume this is not a bug and that I’m doing something wrong.…No errors thrown. Nothing I’m doing seems counter to the documentation and this is all stuff I used to do in Cake 2… there is absolutely no hint whatsoever of what I could possibly be doing wrong.

I’ve gone into the model to edit the EntityTable.php and remove all validation and still no success in saving.

So I lost three whole days trying to get this to work the way it’s supposed to and got nowhere. I threw up my hands, rolled up my sleeves, and did it the “stupid” “long” way… manually.

This cake is starting to seem half-baked, for professional applications at least.

#grumbly frowny

if you could supply code, we could help you more, few things that could go wrong:
your structure is not same as your association suggests
you didnt include association in ‘_accessible’ of entity
you are not using patchEntity/dirty