I am having this error and none of the googled result i checked is similar to my problem.
I have an application with class Deal, User, and Matches
A deal has
Since it was a unique field in my case, I could not make it nullable.
For me, I had an empty constructor which was causing the issue don't know why. Please comment if anyone knows the reason.
public function __construct(){ }
Commenting/removing it resolved the issue.