I have a one to many relationship between two tables in a symmfony application. The registration method of one of the table accepts a JSON POST request. On attempting to insert data into the database manually from mysql interface everything is fine but when I attempt to use a POST request to perform the insertion I get
500 Internal Server Error with a Integrity constraint violation:
this is the controller of the POST request
$register->setConfirmpassword($params["confirmpassword"]);
$register->setAccountfk($params["accountsfk"]);
this is the sample JSON post from postman
{
"accountsfk":2
}
registration has a foreign key to accounts. On making a post request I get this error
with params ["myname", "mylastname", "emails123@email.com", "passwords", "passwords", null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'accountsfk' cannot be null (500 Internal Server Error)
Please what am doing wrong that I am unable to insert records to the registration table