Update primary key fails

61 views
Skip to first unread message

Martin Kopeček

unread,
Jan 31, 2013, 6:53:51 AM1/31/13
to not...@googlegroups.com
Hello! Following code fails:

$row = $table[$old_id];
$row["id"] = $new_id;
$row->update();

This is beause NotORM_Row::offsetSet($var,$value) stores the value in the $this->modified array and also owerwrites values in $this->row.

Why is that? After all the value of $row["id"] shoud be IMO $old_id until $row->update() is called.

Martin

Martin Kopeček

unread,
Jan 31, 2013, 6:56:39 AM1/31/13
to not...@googlegroups.com
Actually it does not fail, it just doesn't change anything, since it tries to update row with $new_id.

Jakub Vrana

unread,
Dec 21, 2013, 8:48:57 AM12/21/13
to not...@googlegroups.com
Hello,

Thanks for the report, I've fixed it.

Jakub
> --
> You received this message because you are subscribed to the Google
> Groups "NotORM" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to notorm+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages