Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. {
  2. "total":2,
  3. "data":[
  4. {
  5. "id":2,
  6. "user":{
  7. "id":1,
  8. "username":"sandro.tchikovani"
  9. },
  10. "description":"cool",
  11. "nb_comments":0,
  12. "nb_likes":0,
  13. "date_creation":"2014-04-13T20:07:34-0700"
  14. },
  15. {
  16. "id":1,
  17. "user":{
  18. "id":1,
  19. "username":"sandro.tchikovani",
  20. },
  21. "description":"Premier pooooste #lol",
  22. "nb_comments":0,
  23. "nb_likes":0,
  24. "date_creation":"2014-04-13T15:15:35-0700"
  25. }
  26. ]
  27. }
  28.  
  29. Class array<MoodressBundlePosteBundleEntityPoste> does not exist
  30.  
  31. $lastPosts = $serializer->deserialize($data['data'], 'array<MoodressBundlePosteBundleEntityPoste>', 'json');
  32.  
  33. $person = $serializer->deserialize($data,'AcmePerson','xml');
  34.  
  35. $person = $serializer->deserialize($data['data'],'MoodressBundlePosteBundleEntityPoste','json');
  36.  
  37. $data = json_decode($yourJsonFile, true);
  38.  
  39. foreach($data['data'] as $result)
  40. {
  41. /* Here you can hydrate your object manually like:
  42. $person = new Person();
  43. $person->setId($user['id']);
  44. $person->setDescription($user['description']);
  45.  
  46. Or you can use a denormalizer. */
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement