tags:

views:

107

answers:

2

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!

A: 

Complete stab in the dark. But in Zend, You have to use Zend_Db_Expr to create a NULL, eg

$object->setName(new Zend_Db_Expr("NULL")); 

Could Doctrine have the same?

jakenoble
A: 

Hi, in this case, when the field is a relation. I have complished this task with:

$record->Parent = null;
$record->save();

Above Parent is the relation name.

oaugustus