[RESOLVED] CakePHP saving makes me want to cry
And this is probably because I am misunderstanding horribly, but please (think of the children?)
Anyway, here we go.
I have a page which edits associated models links to the current model (has many actually). I pass in a data array into save all like so:
for argument's sake. Since the names are unique (it's actually more complex than this) I check for that name, if it exists I set the "id" field in the data to the id of the record in the table (because I want to update not to insert).
array => 0 => array("name"=>"One"), 1=> array("name"=>"Two");
Needless to say, this doesn't work. There are two things that go wrong:
1) I have to cycle through each item and use save() because saveAll() is only taking the first item in the array.
2) No matter how I try and set the ID I can't get it to do anything except insert. How do I make it update?
Any ideas would be most welcome.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread