I have a problem with one specific controller trying to INSERT instead
of UPDATE and I am getting duplicate entry errors. the "$this->data"
variable contains the correct primary key of table I'm trying to
update, but still tries to INSERT instead. Most notable text message
is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
getting the id at all?
Code:
function edit( $id = null )
{
pr( $id );
pr( $this->data );
$this->Employee->id = $id;
if( !empty( $this->data ) )
{
if( $this->Employee->save( $this->data ) )
{
}
} else {
$this->data = $this->Employee->read( null, $id );
}
}
Both the pr functions display the correct data that suggests it should
be doing an UPDATE instead of INSERT.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---