Core: [BUG] Entity decimal property not returning a string

Created on 15 Jul 2018  路  2Comments  路  Source: api-platform/core

I have the following field:

    /**
     * @ORM\Column(name="price", type="decimal", nullable=false, precision=12, scale=4)
     * @var float
     */
    public $price;

If price is 0 the serializer returns an INT not a STRING as expected.
If the type is decimal is should always returns a string.

So if i try to PATCH back the "wrong" response with the int 0 i get the error:
"The type of the "price" attribute must be "string", "integer" given."

bug unconfirmed

Most helpful comment

It looks like a bug to me. Would you mind opening a PR with a failing test?

All 2 comments

It looks like a bug to me. Would you mind opening a PR with a failing test?

Shouldn't it be @var string instead of @var float?

Was this page helpful?
0 / 5 - 0 ratings