Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right way to define annotation for DECIMAL type in Doctrine2

I have a column in my table with DECIMAL(19,4) and I'm creating my Entity for a project, what is the right way to define this field? What precision and scale parameters means in Doctrine Annotations?

like image 826
Reynier Avatar asked Aug 29 '13 13:08

Reynier


1 Answers

The precision is the number of digits in the number. For example, 123456.78 has a precision of 8.

Scale is the is the maximum number of decimal places. 123456.78 has a scale of 2.

DECIMAL(19,4) would allow 19 total digits, with four decimal places.

The annotation for that would be:

@Column(type="decimal", precision=19, scale=4) 
like image 195
StuBez Avatar answered Oct 11 '22 03:10

StuBez