mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-365: The return of the numeric columns with more than two decimal places is wrong #453
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 23, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user zarpelon:
When I run a select on a column of numbers that is with 4 decimal places and value 0.1500, the object has returned me the following value 0.0015, generating inconsistency in data.
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by romanb:
We need example code to reproduce the problem.
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by zarpelon:
My column in my example.yml
value_base:
type: decimal
precision: 14
scale: 4
My function in ExampleRepository
public function getQueryBuilder()
{
$qb = $this->_em->createQueryBuilder()
->select('e')
->from('Project\DomainModel\Example, 'e');
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by @beberlei:
Works for me, i added a test-case with your numbers in Doctrine\Tests\ORM\Functional\TypeTest. Please make it break with your use-case, until then this issue is invalid.
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by zarpelon:
I saw your test, but as I have the test environment setup, could not complement the test case. I believe that when the value of highscale for example 0.1500 to 0.0015 will return. You can try, please?
@doctrinebot commented on GitHub (Mar 14, 2010):
Comment created by @beberlei:
It still works for me, can you report your locale options please?
@doctrinebot commented on GitHub (Apr 5, 2010):
Comment created by zarpelon:
Locale = pt_BR.UTF-8
@doctrinebot commented on GitHub (Apr 5, 2010):
Comment created by @guilhermeblanco:
@zarpelon
It is not a bug of Doctrine. It's a DB issue.
When dealing with locales in DB and PHP is not so obvious. Brazil uses commas for decimal and points for million information.
When you define the value 0.0015, it contains 4 numbers when it expects to have only 3. So it ignores padded 0 values from value, leading the 0015 => 15. Finally, it returns the vaue since 0 (of 0.) is < 3 chars expected.
To solve it, you have to manually deal with number_format and define locale specific settings in order to work correctly.
I'll make a note here if we can do anything related to that, but I doubt it'll be possible.
Cheers,
@doctrinebot commented on GitHub (Apr 5, 2010):
Issue was closed with resolution "Invalid"