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.
Activity
Benjamin Eberlei
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Workflow | jira [ 13171 ] | jira-feedback2 [ 17589 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback2 [ 17589 ] | jira-feedback3 [ 19943 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-180, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
I would strongly suggest to leave the behaviour as-is, and fix the documentation, because of all the trouble associated with floating point and rounding. People use the DECIMAL type to prevent those issues, so having the ORM convert it to floating point again would be pretty bad.