symfony - Rounded decimal in edit form Symfony2 + Doctrine2 -
how set decimal precision , scale within symfony2 entity? i've defined latitude in longitude fields using decimal data type in entity this:
/** * @orm\column(type="decimal", precision="10", scale="6", nullable=true) */ protected $latitude;
when persisting new object saves decimal correctly (i can see 52.406374 in phpmyadmin). when displaying edit form number rounded 52,406 , after updating stored in mysql 52.406000. wrong doctrine configuration, don't know what.
why latitude , longitude getting rounded?
found solution:
symfony's form component renders decimal form field type="text". when using:
->add('latitude', 'number', array( 'precision' => 6, ))
it rendered properly. thread comment doesn't describe problem. guess have fixed bug 'convert float' precision. when displaying latitude in twig template showing proper (not rounded) value.
maybe problem not due doctrine mapping. @ reference documentation numbertype.
it use? have change precision.
Comments
Post a Comment