We got 2 tables where one table is parent and another table as a child with primary and foreign key reference.
Assume table1 is the parent and table2 is the child as below.
table1:
id <- primary key of table1
name <- name field
table2:
id <- primary key of table2 auto increment
par_id <- foreign key referring table1 default to NULL
position <- posiiton field
The code snippet below is to update an existing record in the child table with par_id as NULL
$recObj = new stdClass ();
$recObj->id = '1';
$recObj->par_id=null
$recObj->position="test position"
$db->updateObject('#__table2', $recObj, 'id');
When the above code executes, it is not updating the par_id to null. Instead the old value remains.