0
json 문자열을 내 엔티티 Poste에 매핑하고 싶습니다. 내가 jmsserializer로 역 직렬화하려고Symfony - json 문자열을 엔티티로 변환하는 방법
string(695) "{
"id":2,
"user": {
"id":1,
"username":"tom.smith",
"email":"[email protected]"
// other properties of User class (FOSUserBundle)
},
"description":"cool",
"nb_comments":0,"nb_likes":0,
"date_creation":"2014-04-13T20:07:34-0700",
"is_there_fashtag":false,
"fashtags":[]
}"
: 여기
을 위해서 var_dump 내 json으로 출력$postes[] = $serializer->deserialize($value, 'Moodress\Bundle\PosteBundle\Entity\Poste', 'json');
나는 오류가 있습니다
Catchable Fatal Error: Argument 1 passed to
Moodress\Bundle\PosteBundle\Entity\Poste::setUser() must be an instance of
Moodress\Bundle\UserBundle\Entity\User, array given
을 왜 할 수없는 나 나입니다 간단한 엔티티 poste를 deserialize하려면?
감사
는
JMS 직렬화 기의 올바른 노출/유형 메소드로 엔티티를 매핑 했습니까? http://jmsyst.com/libs/serializer/master/reference/annotations#type – coma