I am trying to use do the most simple update query but Doctrine issues an INSERT statement instead of an UPDATE.
$q = Doctrine_Query::create()
->from('Image i')
->where('id = ?');
$image = $q->fetchOne($articleId, Doctrine_Core::HYDRATE_RECORD);
$image->copyright = "some text";
$image->save();
I have also tried using the example from the manual, but still a new record gets inserted:
$userTable = Doctrine_Core::getTable('User');
$user = $userTable->find(2);
if ($user !== false) {
$user->username = 'Jack Daniels';
$user->save();
}
edit:
This example from the manual works:
$user = new User();
$user->assignIdentifier(1);
$user->username = 'jwage';
$user->save();
The funny thing is that I use this on another model and there it works OK. Maybe I have to fetch the whole array graph for this to work (I have another model in a one to many relationship)?