我在symmfony應用程序中的兩個表之間有一對多的關係。其中一個表的註冊方法接受JSON POST請求。在試圖將數據從MySQL接口一切手動插入到數據庫是好的,但是當我嘗試使用POST請求執行插入我得到Symfony:完整性約束違規:500內部服務器錯誤
500 Internal Server Error with a Integrity constraint violation:
這是POST請求的控制器
$register->setConfirmpassword($params["confirmpassword"]);
$register->setAccountfk($params["accountsfk"]);
這是從郵遞員樣品JSON後
{
"accountsfk":2
}
註冊有一個外鍵賬戶。在作出POST請求我得到這個錯誤
使用參數[" MYNAME "," mylastname "," [email protected] ","密碼","密碼",空]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'accountsfk' cannot be null (500 Internal Server Error)
請問我做錯了,我無法將記錄插入到註冊表中
你能請出示你的實體? –
哪個實體 – parker
實體註冊請 –