Test Setup Failed
Push — main ( abdcb9...2e5f68 )
by Slawomir
04:37
created

Comment::getParentComment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Modules\Comments\Persistence\Doctrine\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Component\Uid\Ulid;
7
8
#[ORM\Entity]
9
#[ORM\Table(name: "COMMENTS")]
10
class Comment
11
{
12
    #[ORM\Id]
13
    #[ORM\Column(type: "ulid", unique: true)]
14
    private Ulid $id;
15
16
    #[ORM\Column(type: "string")]
17
    private string $author;
18
19
    #[ORM\Column(type: "string")]
20
    private string $body;
21
22
    #[ORM\Column(type: "datetime")]
23
    private \DateTime $createdAt;
24
25
    #[ORM\ManyToOne(targetEntity: Comment::class)]
26
    #[ORM\JoinColumn(name: "parentId", referencedColumnName: "id")]
27
    private ?Comment $parentComment;
28
29
30
    #[ORM\ManyToOne(targetEntity: CommentPostHeader::class)]
31
    #[ORM\JoinColumn(name: "postId", referencedColumnName: "id")]
32
    private CommentPostHeader $post;
33
34
    /**
35
     * @return Ulid
36
     */
37
    public function getId(): Ulid
38
    {
39
        return $this->id;
40
    }
41
42
    /**
43
     * @param Ulid $id
44
     */
45
    public function setId(Ulid $id): void
46
    {
47
        $this->id = $id;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getAuthor(): string
54
    {
55
        return $this->author;
56
    }
57
58
    /**
59
     * @param string $author
60
     */
61
    public function setAuthor(string $author): void
62
    {
63
        $this->author = $author;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getBody(): string
70
    {
71
        return $this->body;
72
    }
73
74
    /**
75
     * @param string $body
76
     */
77
    public function setBody(string $body): void
78
    {
79
        $this->body = $body;
80
    }
81
82
    /**
83
     * @return Comment|null
84
     */
85
    public function getParentComment(): ?Comment
86
    {
87
        return $this->parentComment;
88
    }
89
90
    /**
91
     * @param Comment|null $parentComment
92
     */
93
    public function setParentComment(?Comment $parentComment): void
94
    {
95
        $this->parentComment = $parentComment;
96
    }
97
98
    /**
99
     * @return CommentPostHeader
100
     */
101
    public function getPost(): CommentPostHeader
102
    {
103
        return $this->post;
104
    }
105
106
    /**
107
     * @param CommentPostHeader $post
108
     */
109
    public function setPost(CommentPostHeader $post): void
110
    {
111
        $this->post = $post;
112
    }
113
114
    /**
115
     * @return \DateTime
116
     */
117
    public function getCreatedAt(): \DateTime
118
    {
119
        return $this->createdAt;
120
    }
121
122
    /**
123
     * @param \DateTime $createdAt
124
     */
125
    public function setCreatedAt(\DateTime $createdAt): void
126
    {
127
        $this->createdAt = $createdAt;
128
    }
129
130
131
}