SAKRA WebStudio
Thursday, September 6, 2012
How to Save Empty Form Fields as NULL in Symfony
If you leave a field empty in your form, Symfony will save it as a blank value. However sometimes you want to save it as NULL...
Create a method for the field in the form class:
public function updateManufacturerColumn($value) { return (!$value) ? null : $value; }
Manufacturer is the name of the field now.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment