I'm trying to make a form in Symfony 2.8. In my entity class i have a field defined as follows:
/**
* @ORM\Column(type="number")
*/
private $someFloatValue;
Then in controller i'm constructing a form:
$form = $this->createFormBuilder($attribute)
->add('someFloatValue', NumberType::class) ...etc.
Which renders a beatiful html form.
However if i submit the form with value let's say 2.8 i'm receiving an error:
Expected argument of type "number", "double" given
What's even more frustrating, submiting integer values into the form results in the same exact error.
Could anyone please explain me why is it happeining?
Ok i figured it out. I don't know why i used orm column type 'number' but that was wrong. After changing to 'decimal':
/**
* @ORM\Column(type="decimal")
*/
private $someFloatValue;
Everything works as expected.