Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-16509

ezcontentclassattribute-definition should reflect actual database schema - NULL values for numerics

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 4.2.0
    • Database related, Misc
    • None

    Description

      Error:
      ---------
      Storing NULL values using the following code does not work.

      $attribute->setAttribute( 'data_float3', null );
      $ezpersistentobject->storeObject(...);
      

      Because of the defintion in ezcontentclassattribute.php the null-values are being replaced in favor of the defined default_value, which is 0 (zero) for all numeric based datatypes.

      Expected behaviour:
      -------------------

      $attribute->setAttribute( 'date_float3', null);
      $ezpersistentobject->storeObject(...);
      

      Should store the assigned value 'null' into database.

      Sideeffects:
      -----------------
      eZFloat, eZInteger, ... (numeric based) datatypes is usable when the empty string is replaced with null. If a contentclass-attribute is marked 'not required', the database really stores null and not some faked 0 (zero) value which is NOT the value the user has typed in.

      Steps to reproduce

      Create a contentclass, use eZInteger or eZFloat or any other Datatype. This Datatype can be a core datatype or submitted by the community.

      The used Datatype should not be required. Min/Max/Default must be left empty.

      Create a contentobject using this class.
      Do not type anything in.
      Save.

      Result:
      --------
      The value (data_int3, data_float3) have 0 (zero) as value which is obviously wrong by the database definition which can have NULL values.

      Attachments

        Issue Links

          Activity

            People

              unknown unknown
              croessler Christian Rößler
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: