Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-180

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

    Details

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

      Description

      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.

        Activity

          People

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

            Dates

            • Created:
              Updated: