Alex Rivera | Logout

How can I do set NULL into the table in Doctrine

Asked 2010-09-17T11:53:04.140
11

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!

Edit
Report

1 Answer

12

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!

answered 2011-01-25T22:17:52.547

Your Answer