Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-180

Documentation states that Doctrine 'decimal' (DecimalType) is mapped to PHP 'double', however, string is returned


    • Type: Documentation
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:


      At http://www.doctrine-project.org/docs/orm/2.1/en/reference/basic-mapping.html#doctrine-mapping-types, it is stated that:

      "decimal: Type that maps an SQL DECIMAL to a PHP double."

      However, in the commit history, we can see that the casting to a float is removed: https://github.com/doctrine/dbal/commits/master/lib/Doctrine/DBAL/Types/DecimalType.php. Casting to a double is not possible in PHP?This seems to result in a float as well, that is probably why it was removed.

      I found this out when using PHP's 'is_double()' function (alias of is_float()) to check whether a decimal property was set or not.

      Suggestion is to either:

      • cast to a double (which seems not possible)
      • cast to a float (why was this removed?)
      • do nothing to the code, update documentation that string is returned.

      In my check function I guess I will use the is_numeric() function.


        holtkamp Menno Holtkamp created issue -
        beberlei Benjamin Eberlei made changes -
        Field Original Value New Value
        Workflow jira [ 13171 ] jira-feedback2 [ 17589 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17589 ] jira-feedback3 [ 19943 ]


          • Assignee:
            beberlei Benjamin Eberlei
            holtkamp Menno Holtkamp
          • Votes:
            0 Vote for this issue
            3 Start watching this issue


            • Created: