Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

unstable DECIMAL type #134

Description

@dsavina

In dependant doctrine library, a DECIMAL column is now bound to php type string. Therefore, retrieving such a column will return a string, ie a number properly formatted. However, once the column has been set, a float will be returned as long as the object is cached. Future queries will return a string again.

Example

// table `foo` containing column `bar`: DECIMAL(10,2)
$fooBean = $fooDao->getById(1);
echo $fooBean->getBar();
// "4.20"
$fooBean->setBar(4.1);
echo $fooBean->getBar();
// 4.1
$fooBean->setBar("4.10");
echo $fooBean->getBar();
// 4.1

The issues inferred are both an approximative precision and an unstable number format.

(cd doctrine/dbal: 9f51afa2)

Edit: typing error corrected

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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