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