I have some table store_section
(id
,parent_id
,label
), I want to change some row, set parent_id=null.
I trying to:
$record = $table->getTable()->find( $id );
$record->parent_id = null;
$record->save();
But this isn't work. How can I do set NULL into the table in Doctrine, in example above, parent_id becomes =0 (not =NULL)?
Thnx for the responses!
I would try one of the following:
1:
$record = $table->getTable()->find( $id );
$record->parent_id = new Doctrine_Null();
$record->save();
2:
$record = $table->getTable()->find( $id );
$record->parent_id = "NULL";
$record->save();
I have not tested these, but I do recall having a similar issue prior, just cannot recall how I solved it. Hope this helps!
You can use method set('u.name', 'NULL') For example:
Doctrine_Query::create()->update('User u')->set('u.name', 'NULL')->where('u.id = ?',$id);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With