0 votes

Hello.
Can somebody help me with the problem.
For now in ORM Designer I've type called - (Decimal) and after I transform this in database I got some kind of [ decimal(18,2) ].
My question is - How can I make [ decimal(18,1) ] with only one digit after comma.

ORM Framework - Doctrine1

asked in Solved by (250 points)
recategorized by

2 Answers

0 votes
Best answer

I found solution.

If you are using Doctrine1 in ORM Designer and what to change precision you should use "Scale" property and after generation you'll receive
- [ doctrine(int, scale) ]
in my situation if I set scale = 1 then I receive [ decimal(18,1) ]

answered by (250 points)

Perfect. I'm glad you found a solution!

I updated help-text for scale property in ORM Designer to reflect what it does.

Thank you for your time :)

0 votes

It's hard to help without knowledge which ORM framework you're using.

But the best practice is search in ORM documentation if your ORM framework support such feature (in some ORMs it's called "decimal" or "precision"). After you found such feature in ORM documentation, try to find same field property in ORM Property editor.

enter image description here

answered by Skipper developer (135k points)

I'm using - Doctrine1 ORM framework

But in properties I can't find property named - "Precision"
Maybe it's located some where else?

As I wrote in my previous reply. You need to check in ORM documentation if ORM framework supports this feature. Screenshot I sent you was example of Doctrine2 properties.

After quick review of Doctrine1 ORM properties it seems that D1 doesn't support such feature.

Hmm, it's not good. Because even if I use "MySQL Workbench" it's possible to add precision.

Ok. Thanks for answer!

Sure, but MySql Workbench doesn't use ORM to define columns. MySql Workbench directly modifies database structure. On the other hand ORM Designer strictly uses only features offered by specific ORM.

So if ORM framework doesn't support it, it's not possible to configure it via ORM Designer ;-).

Great! You're right, scale seems to do the job.
I also checked Doctrine1 documentation to be sure and D1 really doesn't support decimal modifier: http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/defining-models.html

Thank you solution was found for Doctrine1 in ORM Designer :)