1
Guide
을 내 데이터베이스에 게시하려고합니다. 내 요구는 다음과 같습니다Symfony 3 - 개체를 EntityType에 전달하십시오.
{
"name": "test",
"comany": 1
}
내 양식이이 작동
$builder
->add('name', TextType::class)
->add('company', EntityType::class, array('class' => 'AppBundle:Company', 'allow_extra_fields' => true));
하지만 내 프론트 엔드에서 객체로 company
에 요청을하는 것이 더 쉽습니다 만 통과 않을 것이다 이드. 나는이 같은 요청을 한 경우 :
{
"name": "test",
"company": {
"id": 1,
"name": "company1"
}
}
을 나는 Bad Request {"form":{"children":{"name":{},"company":{"errors":["This value is not valid."]}}},"errors":["This value is not valid."]}
가 어떻게이 문제를 해결할 수있는 오류를 얻을?
내 문제를 해결하는 데 도움을 주셔서 감사합니다. – Oudstand