symfony2 学说十进制精度刻度注释被忽略 [英] symfony2 doctrine decimal precision scale annotations are ignored

查看:20
本文介绍了symfony2 学说十进制精度刻度注释被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的实体中设置了一个属性,如下所示:

i've set up an attribute in my entity like this :

/**
 * @var decimal
 *
 * @ORM\Column(name="latitude", type="decimal", precision=10, scale=7, nullable=true)
 */
private $latitude;

但是当我使用以下命令生成数据库模式时:doctrine:database:create;学说:模式:创建

but when i generate the database schema with : doctrine:database:create; doctrine:schema:create

我的字段在数据库中设置为十进制 (10,0)(当我使用 phpmyadmin 查找时)因此,当在表单中插入 42.123456 之类的数据时,此数据会被截断为 42.

my field is set up to decimal (10,0) in the database (when i look up with phpmyadmin) and so, when in insert data like 42.123456 with a form, this data is truncated to 42.

我该如何解决这个问题?

how can i resolve this?

谢谢.

推荐答案

好的,终于可以解决这个问题了.只需手动删除缓存 (app/cache/..)

Ok, finally get to resolve this. Simply manually remove the cache (app/cache/..)

通过 symfony 命令缓存删除它:清除 不会解决问题

removing it by symfony command cache:clear wont revolve the problem

这篇关于symfony2 学说十进制精度刻度注释被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆