0

I'm trying to updateall for coloursets. When I read the data into the form, the table is added, but when I try to write back to it, the table isn't joined.

Warning (512): SQL Error: 1054: Unknown column 'Fanpage.Colourset' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]

Query:

UPDATE `fanpages` AS `Fanpage`
LEFT JOIN `users` AS `User` ON (`Fanpage`.`user_id` = `User`.`id`)
LEFT JOIN `accounts` AS `Account` ON (`Fanpage`.`account_id` = `Account`.`id`)
SET `Fanpage`.`Colourset` = Array, `Fanpage`.`Fanpage` = Array
WHERE 1 = 1 

code for models, controllers, tables etc here: http://bin.cakephp.org/view/1132666511

When I had used SaveAll(), the records were added to the colourset table, but when I try updateAll(), the colourset table doesn't seem to be available.

(sorry for the messy code - I'm new :) )

Any help is appreciated - I've been googling for 2 days and I can't figure out what the problem is. I've tried changing the relationship etc.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
binky
  • 123
  • 7
  • is this what I need to be looking at? http://nuts-and-bolts-of-cakephp.com/2008/07/17/forcing-an-sql-join-in-cakephp/ – binky Aug 29 '11 at 15:46
  • I haven't solved it yet, but I think this is what I wanted: $this->Fanpage->Colourset->UpdateAll() – binky Aug 29 '11 at 18:41

1 Answers1

0

that's not what updateAll is used for, use saveAll.

Anh Pham
  • 5,431
  • 3
  • 23
  • 27
  • The colours are in a form and the user will be able to change them. so, I need to update these colours though, not save new records of them. – binky Aug 29 '11 at 18:40
  • As long as you maintain the id of each colourset (which I see you have, in the bin), cake will update the records. – Anh Pham Aug 29 '11 at 20:23
  • That is soooo confusing - thanks for sorting me out tho - you were right :) if($this->Fanpage->Colourset->SaveAll($this->data['Colourset'])) { echo "YAY!"; } – binky Aug 29 '11 at 20:59