Hi, I have a question about some generic method for preventing inserting empty string into database for field another then TEXT e.g. Data.
Please imageine we have got form with two fileds: name - varchar dob - date
Now in controller I'm using assign method to insert that values to Model object.
If I don't fill dob field then to that field in model will be assigned "" so trying save to database will casue error. "" isn't correct date representation.
Another case is I have got correct date, object is saved into DB. Now I wanted to updated that object and clear date field. And here similar "" will be assigned to date field and error will be returned on Update query.
I was thinking about php arrayfilter to remove empty strings, null values , etc. but in that case I will be unable to clear value in text field.
What solution do You use.
thanks