Skip to content

[Doctrine] price property is an integer and a float #9677

Closed
@alexislefebvre

Description

@alexislefebvre

On 4.0+ documentation, an entity is created and its price property is an integer:

    /**
     * @ORM\Column(type="integer")
     */
    private $price;

A note explain this:

Confused why the price is an integer? Don't worry: this is just an example. But, storing prices as integers (e.g. 100 = $1 USD) can avoid rounding issues.

But when the entity is persisted a float number is provided:

        $product->setPrice(19.99);

I think that this is inconsistent.


It's related to #9487.

I can provide a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions