Bug Report
Summary
Incorporating BcMath\Number I ran into an unexpected (or not) issue. Since NumberType only accepts Number when converting to database value, one cannot use integers as query parameters.
Current behavior
$repository->count(['number' => 0]);
will yield:
Could not convert PHP value 0 to type Doctrine\DBAL\Types\NumberType. Expected one of the following types: null, BcMath\Number
Expected behavior
Expected $repository->count(['number' => 0]); to keep working when number is BcMath\Number especially because comparisons between integer and Number are supported in PHP.
How to reproduce
Have an entity with a BcMath\Number field:
#[ORM\Column(type: Types::NUMBER, precision: 5, scale: 2)]
private BcMath\Number $number;
Try to get a count of all zero values:
$repository->count(['number' => 0]);
Unfortunately phpstan-doctrine won't catch these either.
Bug Report
Summary
Incorporating BcMath\Number I ran into an unexpected (or not) issue. Since NumberType only accepts Number when converting to database value, one cannot use integers as query parameters.
Current behavior
will yield:
Expected behavior
Expected
$repository->count(['number' => 0]);to keep working when number is BcMath\Number especially because comparisons between integer and Number are supported in PHP.How to reproduce
Have an entity with a
BcMath\Numberfield:Try to get a count of all zero values:
Unfortunately phpstan-doctrine won't catch these either.