eZ Community » Forums » Developer » HOWTO?: Fill db field with "NULL"
expandshrink

HOWTO?: Fill db field with "NULL"

HOWTO?: Fill db field with "NULL"

Thursday 30 June 2005 1:16:45 pm - 3 replies

Hi,
I am trying to fill a certain field of a persistent object with "NULL" but it does not work out... How can I do this. Filling the field with a "0" value works fine.

From func definition

"expires" => array(  'name' => "Expires",
                                                              'datatype' => 'integer',
                                                              'default' => null,
                                                              'required' => false )
                                                               )


Code that does not work for me to insert null data in db...

$mypersistentobject = new mypersistentobject( $row )
$mypersistentobject->setAttribute( 'expires', null );
$mypersistentobject->store();

thx

Thursday 07 July 2005 12:26:38 pm

Nobody?

Thursday 07 July 2005 2:17:20 pm

Hi Björn

I've had a brief look at the storeObject() function of the eZPersistentObject class and it does not appear possible to achieve what you want without patching the eZPersistentObject class or overriding the storeObject() function in your class.

Cheers
Bruce

Wednesday 04 July 2012 4:46:49 pm

Hi,

this problem still exists, does it? Sometimes it is necessary to store NULL in persistent objects' attributes.

Is there an issue reported within the issue tracker?

Cheers
Jean 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu