具有验证约束的 Symfony 2 数字字段不起作用

Symfony 2 Number Field with validation constraint not working

我尝试在数字字段中插入一个字符串来进行验证,但它不起作用

/**
     * @Assert\Length(max = "16")
     * @Assert\NotBlank(groups={"specific"},message="Le montant doit etre renseigné")
     * @Assert\Type(type="numeric", message="La valeur {{ value }} n'est pas un nombre.")
     *
     * @var decimal $amount
     *
     * @ORM\Column(name="amount", type="decimal", length=16, nullable=true)
     */
    private $amount;

每次提交表单时都会出现 postgresql 错误:

SQLSTATE[22P02]: Invalid text representation

我期待的是以下消息

"The value is xxx not a number"

我正在使用 symfony 2.4,在 php 5.5

服务器上安装了 INTL 扩展

我指定验证组来考虑

/**
     * @Assert\Length(max = "9")
     * @Assert\Type(groups={"avantage"},type="numeric", message="La valeur {{ value }} n'est pas un nombre.")
     * @Assert\NotBlank(groups={"avantage"},message="Le montant doit etre renseigné")
     *
     * @var decimal $amount
     *
     * @ORM\Column(name="amount", type="decimal", length=16, nullable=true)
     */
    private $amount;