Closed fcamargo10 closed 7 years ago
That sure looks like an SQL error for your table field called "photo" :-)
Could you try to debug internally if something is getting set to null for some reason?
DocumentsTable
right?['type' => 'file']
?notEmpty()
and requirePresence()
in your DocumentsTable
validation?I'm not sure how your code is managing to save a Document with an empty photo
field, but that's why you're seeing the error. So some PHP validation here would help catch this in PHP, where it will be easier to handle.
So you are attaching the behaviour to the DocumentsTable right?
Right!
The form type is ['type' => 'file']
Yes
You are validating the field is notEmpty() and requirePresence() in your DocumentsTable validation?
Yes
If i comment the behavior works fine.
The problem has been fixed. Thanks guys.
@filipecamargo10 wondering how you fixed the problem. Currently facing same issue.
You need to ensure your form and field type are both file
. This is almost always missed. Please do so, but if you have any other issues, file a separate bug. Thanks.
With this new version i try and not work.
Model
Controller
View
I already put the form type as file.
The error is:
Error: SQLSTATE[HY000]: General error: 1364 Field 'photo' doesn't have a default value
When i comment the behavior everything work's fine. Anyone can help me ?