Passed
Pull Request — master (#49)
by
unknown
14:57
created

Comment::getPublishedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Entity;
4
5
use Cycle\Annotated\Annotation\Column;
6
use Cycle\Annotated\Annotation\Entity;
7
use Cycle\Annotated\Annotation\Relation\BelongsTo;
8
use Cycle\Annotated\Annotation\Table;
9
use Cycle\Annotated\Annotation\Table\Index;
10
use DateTimeImmutable;
11
12
/**
13
 * @Entity(
14
 *     mapper="App\Mapper\CommentMapper",
15
 *     constrain="App\Constrain\CommentPublic"
16
 * )
17
 * @Table(
18
 *     indexes={
19
 *         @Index(columns={"public","publishedAt"})
20
 *     }
21
 * )
22
 */
23
class Comment
24
{
25
    /**
26
     * @Column(type="primary")
27
     * @var int
28
     */
29
    private $id;
30
31
    /**
32
     * @Column(type="bool", default="false")
33
     * @var bool
34
     */
35
    private $public;
36
37
    /**
38
     * @Column(type="text")
39
     * @var string
40
     */
41
    private $content;
42
43
    /**
44
     * @Column(type="datetime")
45
     * @var DateTimeImmutable
46
     */
47
    private $createdAt;
48
49
    /**
50
     * @Column(type="datetime")
51
     * @var DateTimeImmutable
52
     */
53
    private $updatedAt;
54
55
    /**
56
     * @Column(type="datetime", nullable=true)
57
     * @var DateTimeImmutable|null
58
     */
59
    private $publishedAt;
60
61
    /**
62
     * @Column(type="datetime", nullable=true)
63
     * @var DateTimeImmutable|null
64
     */
65
    private $deletedAt;
66
67
    /**
68
     * @BelongsTo(target="App\Entity\User", nullable=false, load="eager")
69
     * @var User|\Cycle\ORM\Promise\Reference
70
     */
71
    private $user;
72
73
    /**
74
     * @BelongsTo(target="App\Entity\Post", nullable=false)
75
     * @var Post|\Cycle\ORM\Promise\Reference
76
     */
77
    private $post;
78
79
    public function getId(): ?string
80
    {
81
        return $this->id;
82
    }
83
84
    public function getContent(): string
85
    {
86
        return $this->content;
87
    }
88
89
    public function setContent(string $content): void
90
    {
91
        $this->content = $content;
92
    }
93
94
    public function isPublic(): bool
95
    {
96
        return $this->public;
97
    }
98
99
    public function setPublic(bool $public): void
100
    {
101
        $this->public = $public;
102
    }
103
104
    public function getCreatedAt(): DateTimeImmutable
105
    {
106
        return $this->createdAt;
107
    }
108
109
    public function getUpdatedAt(): DateTimeImmutable
110
    {
111
        return $this->updatedAt;
112
    }
113
114
    public function getDeletedAt(): ?DateTimeImmutable
115
    {
116
        return $this->deletedAt;
117
    }
118
119
    public function setUser(User $user)
120
    {
121
        $this->user = $user;
122
    }
123
124
    public function getUser(): User
125
    {
126
        return $this->user;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->user could return the type Cycle\ORM\Promise\Reference which is incompatible with the type-hinted return App\Entity\User. Consider adding an additional type-check to rule them out.
Loading history...
127
    }
128
129
    public function setPost(Post $post)
130
    {
131
        $this->post = $post;
132
    }
133
134
    public function getPost(): Post
135
    {
136
        return $this->post;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->post could return the type Cycle\ORM\Promise\Reference which is incompatible with the type-hinted return App\Entity\Post. Consider adding an additional type-check to rule them out.
Loading history...
137
    }
138
139
    public function getPublishedAt(): ?DateTimeImmutable
140
    {
141
        return $this->publishedAt;
142
    }
143
144
    public function setPublishedAt(?DateTimeImmutable $publishedAt): void
145
    {
146
        $this->publishedAt = $publishedAt;
147
    }
148
}
149