ObjectWithXmlRootNamespace.php 963 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures;
  3. use JMS\Serializer\Annotation\Type;
  4. use JMS\Serializer\Annotation\XmlAttribute;
  5. use JMS\Serializer\Annotation\XmlRoot;
  6. /**
  7. * @XmlRoot("test-object", namespace="http://example.com/namespace")
  8. */
  9. class ObjectWithXmlRootNamespace
  10. {
  11. /**
  12. * @Type("string")
  13. */
  14. private $title;
  15. /**
  16. * @Type("DateTime")
  17. * @XmlAttribute
  18. */
  19. private $createdAt;
  20. /**
  21. * @Type("string")
  22. * @XmlAttribute
  23. */
  24. private $etag;
  25. /**
  26. * @Type("string")
  27. */
  28. private $author;
  29. /**
  30. * @Type("string")
  31. * @XmlAttribute
  32. */
  33. private $language;
  34. public function __construct($title, $author, \DateTime $createdAt, $language)
  35. {
  36. $this->title = $title;
  37. $this->author = $author;
  38. $this->createdAt = $createdAt;
  39. $this->language = $language;
  40. $this->etag = sha1($this->createdAt->format(\DateTime::ISO8601));
  41. }
  42. }