I would like to know about this particular validation behaviour, although is more out of curiosity than to solve a real life problem, I'm interested to know the answer.
Entity property price is defined as:
/**
* @ORM\Column(name="price", type="float", nullable=false)
*/
In the Symfony manual targeting 2.7, range min and max options are 'integer' types. But actually using a float, it does work as expected:
#validation.yml
Project\MyBundle\Entity\Product:
properties:
price:
- Range:
min: 0.01
max: 12.90
minMessage: Price can't be lower than 0,01€
maxMessage: Price can't be lower than 12,90€
max validation works without any problem making any value higher than 12,90 fail as seen in the picture. min validation does not:
Entering 0,009 will pass validation although is minor than 0,01.
Is there any reason that min and max values are documented as type: integer but work to validate float values ? Has anyone a valid answer for this one ?