Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.3
-
Fix Version/s: 2.0.5
-
Component/s: None
-
Labels:None
-
Environment:Linux Ubuntu 10.10 x86_64, PHP 5.3.3-1ubuntu9.3, mysql Ver 14.14 Distrib 5.1.49
Description
I have a Doctrine 2 entity and the value is mapped like this (with regular getter/setter):
/** * @Column(type="decimal", precision=40, scale=30) */ protected $someValue; /** * @return decimal */ public function getSomeValue() { return $this->someValue; } /** * @param decimal $someValue */ public function setSomeValue($someValue) { $this->someValue = $someValue; }
When I set that value from my code, the value gets written into the database correctly. But, and that is my problem, when I get the value (via getter or \Doctrine\Common\Util\Debug::dump()), it always gives me a number with maximum 14 digits, and it rounds the value. I read the record with the default findById().
eg: with value 1234567890.012345678901234567890123456789 I have 1234567890.0123
eg: with value 890.0123456789012345678901234567890123456 I have 890.01234567890
I of course want all digits, not just 14. The field in MySQL is declared like this:
someValue decimal(40,30) NOT NULL,
When I get the value with raw PHP and mysql_query(), it returns correctly.
It seems like the problem is that Doctrine returns a float: ["someValue":protected]=> float(234567890.01235)
What's wrong, what should I check next, how to fix, any clues?
(also posted on http://stackoverflow.com/questions/5635500/doctrine-2-decimal-can-only-contain-14-digits)
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
I have a Doctrine 2 entity and the value is mapped like this (with regular getter/setter): /** * @Column(type="decimal", precision=40, scale=30) */ protected $someValue; /** * @return decimal */ public function getSomeValue() { return $this->someValue; } /** * @param decimal $someValue */ public function setSomeValue($someValue) { $this->someValue = $someValue; } When I set that value from my code, the value gets written into the database correctly. But, and that is my problem, when I get the value (via getter or \Doctrine\Common\Util\Debug::dump()), it always gives me a number with maximum 14 digits, and it rounds the value. I read the record with the default findById(). eg: with value 1234567890.012345678901234567890123456789 I have 1234567890.0123 eg: with value 890.0123456789012345678901234567890123456 I have 890.01234567890 I of course want all digits, not just 14. The field in MySQL is declared like this: someValue decimal(40,30) NOT NULL, When I get the value with raw PHP and mysql_query(), it returns correctly. It seems like the problem is that Doctrine returns a float: ["someValue":protected]=> float(234567890.01235) What's wrong, what should I check next, how to fix, any clues? (also posted on http://stackoverflow.com/questions/5635500/doctrine-2-decimal-can-only-contain-14-digits) |
I have a Doctrine 2 entity and the value is mapped like this (with regular getter/setter): {code} /** * @Column(type="decimal", precision=40, scale=30) */ protected $someValue; /** * @return decimal */ public function getSomeValue() { return $this->someValue; } /** * @param decimal $someValue */ public function setSomeValue($someValue) { $this->someValue = $someValue; } {code} When I set that value from my code, the value gets written into the database correctly. But, and that is my problem, when I get the value (via getter or \Doctrine\Common\Util\Debug::dump()), it always gives me a number with maximum 14 digits, and it rounds the value. I read the record with the default findById(). eg: with value 1234567890.012345678901234567890123456789 I have 1234567890.0123 eg: with value 890.0123456789012345678901234567890123456 I have 890.01234567890 I of course want all digits, not just 14. The field in MySQL is declared like this: someValue decimal(40,30) NOT NULL, When I get the value with raw PHP and mysql_query(), it returns correctly. It seems like the problem is that Doctrine returns a float: ["someValue":protected]=> float(234567890.01235) What's wrong, what should I check next, how to fix, any clues? (also posted on http://stackoverflow.com/questions/5635500/doctrine-2-decimal-can-only-contain-14-digits) |
| Description |
I have a Doctrine 2 entity and the value is mapped like this (with regular getter/setter): {code} /** * @Column(type="decimal", precision=40, scale=30) */ protected $someValue; /** * @return decimal */ public function getSomeValue() { return $this->someValue; } /** * @param decimal $someValue */ public function setSomeValue($someValue) { $this->someValue = $someValue; } {code} When I set that value from my code, the value gets written into the database correctly. But, and that is my problem, when I get the value (via getter or \Doctrine\Common\Util\Debug::dump()), it always gives me a number with maximum 14 digits, and it rounds the value. I read the record with the default findById(). eg: with value 1234567890.012345678901234567890123456789 I have 1234567890.0123 eg: with value 890.0123456789012345678901234567890123456 I have 890.01234567890 I of course want all digits, not just 14. The field in MySQL is declared like this: someValue decimal(40,30) NOT NULL, When I get the value with raw PHP and mysql_query(), it returns correctly. It seems like the problem is that Doctrine returns a float: ["someValue":protected]=> float(234567890.01235) What's wrong, what should I check next, how to fix, any clues? (also posted on http://stackoverflow.com/questions/5635500/doctrine-2-decimal-can-only-contain-14-digits) |
I have a Doctrine 2 entity and the value is mapped like this (with regular getter/setter): {code} /** * @Column(type="decimal", precision=40, scale=30) */ protected $someValue; /** * @return decimal */ public function getSomeValue() { return $this->someValue; } /** * @param decimal $someValue */ public function setSomeValue($someValue) { $this->someValue = $someValue; } {code} When I set that value from my code, the value gets written into the database correctly. But, and that is my problem, when I get the value (via getter or \Doctrine\Common\Util\Debug::dump()), it always gives me a number with maximum 14 digits, and it rounds the value. I read the record with the default findById(). eg: with value 1234567890.012345678901234567890123456789 I have 1234567890.0123 eg: with value 890.0123456789012345678901234567890123456 I have 890.01234567890 I of course want all digits, not just 14. The field in MySQL is declared like this: {code} someValue decimal(40,30) NOT NULL, {code} When I get the value with raw PHP and mysql_query(), it returns correctly. It seems like the problem is that Doctrine returns a float: ["someValue":protected]=> float(234567890.01235) What's wrong, what should I check next, how to fix, any clues? (also posted on http://stackoverflow.com/questions/5635500/doctrine-2-decimal-can-only-contain-14-digits) |
| Project | Doctrine 2 - ORM [ 10032 ] | Doctrine DBAL [ 10040 ] |
| Key | DDC-1112 |
|
| Affects Version/s | 2.0.3 [ 10119 ] | |
| Affects Version/s | 2.0.3 [ 10117 ] | |
| Component/s | ORM [ 10012 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0.5 [ 10132 ] | |
| Resolution | Fixed [ 1 ] |
| Workflow | jira [ 12556 ] | jira-feedback2 [ 17710 ] |
| Workflow | jira-feedback2 [ 17710 ] | jira-feedback3 [ 20065 ] |
- 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-121, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
ah yes, this is a bug.