I have a Symfony2 form with a variety of fields, including one optional text field called recap.
This recap field saves perfectly when there's some text in it, but when the field is left blank, I get this error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'recap' cannot be null
That's right - the column recap can't be null. I set it that way on purpose. Null means unknown. When the user leaves recap blank, the value of recap is not unknown; it's blank.
My question is how to get Symfony to save recap as '' when it's blank, not null.
DBAL\Types, which casts a null value to an emppty string.