I have a table and one of the columns can be null.
In symfony, with generated form, when i leave field for that column empty, script saves to database an empty string instead of null.
How to change it?
You can override your doSave() function in your form after you check and set your form value to do whatever you want.
protected function doSave($con = null) {
if ($this->getValue('myFormValue') == '') { // do whatever test you want to determine if the variable should be null
$this->setMyFormValue(null); // if it is, set it null
}
parent::doSave($con); // continue with the parent save()
}