Log.php 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation\SerializedName;
  4. use JMS\Serializer\Annotation\Type;
  5. use JMS\Serializer\Annotation\XmlList;
  6. use JMS\Serializer\Annotation\XmlMap;
  7. use JMS\Serializer\Annotation\XmlRoot;
  8. /** @XmlRoot("log") */
  9. class Log
  10. {
  11. /**
  12. * @SerializedName("author_list")
  13. * @XmlMap
  14. * @Type("AuthorList")
  15. */
  16. private $authors;
  17. /**
  18. * @XmlList(inline=true, entry = "comment")
  19. * @Type("array<JMS\Serializer\Tests\Fixtures\Comment>")
  20. */
  21. private $comments;
  22. public function __construct()
  23. {
  24. $this->authors = new AuthorList();
  25. $this->authors->add(new Author('Johannes Schmitt'));
  26. $this->authors->add(new Author('John Doe'));
  27. $author = new Author('Foo Bar');
  28. $this->comments = array();
  29. $this->comments[] = new Comment($author, 'foo');
  30. $this->comments[] = new Comment($author, 'bar');
  31. $this->comments[] = new Comment($author, 'baz');
  32. }
  33. }