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