Details
-
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: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.
There may be other issues around comparison. I'd rather be comparing numeric types than strings when comparing "decimal" values.